abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elliot Metsger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ABDERA-271) ServletRequestContext.initBaseUri(...) appends the webapp context path
Date Wed, 17 Nov 2010 20:31:13 GMT

    [ https://issues.apache.org/jira/browse/ABDERA-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933140#action_12933140
] 

Elliot Metsger commented on ABDERA-271:
---------------------------------------

We have a custom CollectionInfo implementation which is implementing:
  public Collection asCollectionElement(RequestContext request)

In our implementation we obtain a Collection instance from the Factory.  We set the href of
the collection by appending the result of:
request.getBaseUri().toASCIIString() and request.urlFor("feed", params).

request.getBaseUri() includes the context path, and the AbstractProvider also returns the
context path in its urlFor(...) implementation.  Therefore our <collection> hrefs end
up with the context path duplicated in the url.

Are we doing something incorrect in our implementation?

Many thanks -


> ServletRequestContext.initBaseUri(...) appends the webapp context path
> ----------------------------------------------------------------------
>
>                 Key: ABDERA-271
>                 URL: https://issues.apache.org/jira/browse/ABDERA-271
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Elliot Metsger
>
> I may be mis-interpreting, but according to RequestContext's {{getBaseUri()}} method
should not include the webapp context path:
> {quote}
>   /**
>    * Get the absolute base URI ... this is the request URI up to the Context 
>    * Path of the web application within which the Abdera Servlet is deployed
>    */
>   IRI getBaseUri();
> {quote}
> Yet in the {{ServletRequestContext.initBaseUri(...)} method the webapp context path is
appended:
> {quote}
>   private static IRI initBaseUri(
>     Provider provider, 
>     HttpServletRequest request) {
>       StringBuilder buffer = 
>         new StringBuilder(
>           (request.isSecure())?
>             "https":"http");
>       buffer.append("://");
>       buffer.append(getHost(provider,request));
>       int port = getPort(provider,request);
>       if (port != 80) {
>         buffer.append(":");
>         buffer.append(port);
>       }
>       buffer.append(request.getContextPath());
>       // So that .resolve() works appropriately.
>       buffer.append("/");
>       return new IRI(buffer.toString());
>   }
> {quote}
> Am I mis-reading the Javadoc, or is ServletRequestContext doing the incorrect thing?
> This bug is causing incorrect <collection> href urls to appear in our Service Documents.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message