logo
down
shadow

HttpServletRequest getting request parameters separated by # instead of?


HttpServletRequest getting request parameters separated by # instead of?

By : user40661
Date : November 22 2020, 10:31 AM
I think the issue was by ths following , Those aren't query parameters. They're the fragment of the URI - and that isn't sent to the server at all. It can only be used client-side.
From RFC 3986:
code :


Share : facebook icon twitter icon
Is it possible to add to the available parameters of a request (HttpServletRequest)

Is it possible to add to the available parameters of a request (HttpServletRequest)


By : Silviu
Date : March 29 2020, 07:55 AM
Does that help Subclass HttpServletRequestWrapper and override the getParameter methods. The description of this class reads:
Getting parameters from PUT HttpServletRequest?

Getting parameters from PUT HttpServletRequest?


By : KarlV
Date : March 29 2020, 07:55 AM
Any of those help See the the following SO question, seems to answer your question:
Servlet parameters and doPut
HttpServletRequest get no parameters?

HttpServletRequest get no parameters?


By : Derik Malenda
Date : March 29 2020, 07:55 AM
may help you . Your servlet is not mapped to the url / . Your servlet code is not being invoked. Either have / in web.xml or have "" in the JSP.
Retrofit: How to specify comma-separated parameters in request?

Retrofit: How to specify comma-separated parameters in request?


By : user2396696
Date : March 29 2020, 07:55 AM
hope this fix your issue So, as we already found out the problem was in ? -> & typo. But one more thing to be mentioned is that Retrofit can accept complex objects as call parameters. Then String.valueOf(object) will be called to convert object into Query/Path param.
In your case you could define custom class like that:
code :
class LatLng {
  private double lat;
  private double lng;

  ...

  @Override public String toString() {
    return String.format("%.1f,%.1f", lat, lng);
  }
}
@GET("/explore?limit=50&radius=25000&v=20140905&venuePhotos=1&oauth_token=xxyyxx")
void getVenues(@Query("ll") LatLng ll, Callback<String> cb);
public class FoursquareResponse<T> {
  private MetaResponse meta;
  private T response;
  // getters
}
@GET("/explore?limit=50&radius=25000&v=20140905&venuePhotos=1&oauth_token=xxyyxx")
void getVenues(@Query("ll") LatLng ll, Callback<FoursquareResponse<VenuesExploreResponse>> cb);

...

foursquare.getVenues(LatLng.valueOf(30.26, -97.74), new Callback<FoursquareResponse<VenuesExploreResponse>>() {
    @Override 
    public void success(FoursquareResponse<VenuesExploreResponse> r, Response response) {
        MetaResponse metaResponse = r.getMeta;
        VenuesExploreResponse myResponse = r.getResponse();

        // Store results from myResponse in List
    }

    @Override
    public void failure(RetrofitError error) {
        Log.d(TAG, "Failures!");
    }
});
Ajax request with slash separated parameters

Ajax request with slash separated parameters


By : Christian Bailey
Date : March 29 2020, 07:55 AM
will be helpful for those in need Little late to the game, but I would use Object.keys with for each if you want to loop over the object that holds the values.
code :
function urlReplace(url, params) {
  Object.keys(params).forEach(function(key) {
    //url = url.replace(new RegExp(":" + key), params[key]);
    url = url.replace(":" + key, params[key]);
  });
  return url;
}


var url = urlReplace("http://example.com/api/get_nearest_places/:en_type_id/:longtude/:latitude", {
  longtude: 33.42432,
  latitude: 42.3243,
  en_type_id: 1
});

console.log(url);
function urlReplace(url, params) {
  return url.replace(/:([^\/]+)/g, function(match, key) {
    return params[key];
  });
}


var url = urlReplace("http://example.com/api/get_nearest_places/:en_type_id/:longtude/:latitude", {
  longtude: 33.42432,
  latitude: 42.3243,
  en_type_id: 1
});

console.log(url);
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org