How to get POST url with parameters from HttpServletReqest in ServletFilter? (For proxy application)

Due to browser limitations, I need to use a proxy to work with openlayers map.

The OpenLayers.ProxyHost javascript object handles the creation of the url, for example:

http: // webhost: 8080 / app / proxy /? url = http: // WFS_server / options / ...

Some of the requests will be GET and others will be POST.

I wrote a servlet filter that will receive the request and then use the public HttpClient to send it to the host specified by the 'url' parameter.

Everything works for GET, but I am having a hard time getting the url parameter value for POST.

According to the javadoc I see in eclipse it should be request.getRequestURI (), but this returns the post value minus the url parameter value (i.e. http: // webhost: 8080 / app / proxy / )

In fact, the only way to get the data is to call the request.toString () method and parse the URL.

I am deploying Jetty Server 6.1.11, so I am wondering if this could be a Jetty bug or if I am missing something, where can I get this detail?

0


a source to share


3 answers


If the url parameter is sent in the body of the POST, you can use:



request.getParameter( "url" );

      

+3


a source


This is because getRequestURI gives you exactly what you asked for - the URI.

In your post, the url parameter is NOT part of the URI. Ergo, QED, etc.



So, just enter, you need to write a routine to create a url of your own self. Query won't help here.

+1


a source


For POST, you will need to use something similar to below to get the custom parameters.

Map params = request.getParamterMap();
String value = (String) params.get("url");

      

+1


a source







All Articles