users@jersey.java.net

Re: [Jersey] Binding resource to base uri

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Mar 2009 18:02:24 +0100

On Mar 10, 2009, at 3:14 PM, Саид Асадуллин wrote:

>> It would be of great help if you could try debugging the
>> ServletContainer.service method on WebSphere? and reporting back how
>> things behave?
>
> Here is variables from websphere debug session, hope it helps.
>
> before UriBuilder absoluteUriBuilder =
> UriBuilder.fromUri(request.getRequestURL().toString());
>
> "request.getPathInfo()"= null

It appears we have an API conformance issue.

I think the problem is the above value. In Glassfish and Tomcat:

   HttpServletRequest,getPathInfo() == "/"

   HttpServletRequest,getServletPath() == "/request"

i.e. so the full URL path can be created by:

    r.getContextPath() + r.getServletPath() + r.getPathInfo()


What is the HttpServletRequest,getServletPath() on WebSphere?

Paul.

>
> "request.getRequestURI()"= "/webapp/resource/"
> "request.getRequestURL().toString()"= "http://localhost:9081/webapp/resource/
> "
> "request.getContextPath()"= "/webapp"
>
> "decodedBasePath" = "/webapp/"
>
> absoluteUriBuilder.paths contains 3 elements ["webapp","resource", ""]
>
>> final URI baseUri = absoluteUriBuilder.replacePath(encodedBasePath).
> build();
>
> "baseuri.toString()" = "http://localhost:9081/webapp/"
>
>> final URI requestUri =
>> absoluteUriBuilder.replacePath(request.getRequestURI()).
> replaceQuery(queryParameters).
> build();
>
> requestUri.toString() = "http://localhost:9081/webapp/resource/"
>
> If I`ve missed something, please, let me know.
>
> Best regards,
> Saiid.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>