[Yanel-dev] [BUG] Cookie path is empty instead forward slash [WAS: Re: Context path issue if Yanel deployed inside ROOT context

Michael Wechner michael.wechner at wyona.com
Thu Jul 21 16:28:52 CEST 2011


I have created a bug entry for this:

http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=8445

Am 12.07.11 01:15, schrieb Michael Wechner:
> Hi
>
> Yanel is setting various "global" cookies and hence the context path 
> is set as cookie path.
> The problem was that if Yanel is deployed inside the ROOT context 
> (e.g. of Tomcat), then the method
> HttpServletRequest.getContextPath() returns an empty string, but 
> instead one should use a "forward slash".
>
> I have fixed this now as follows
>
> +        String contextPath = request.getContextPath();
> +        if (contextPath.length() == 0) { // INFO: 
> http://download.oracle.com/javaee/5/api/javax/servlet/http/HttpServletRequest.html#getContextPath%28%29
> +            //log.debug("It seems like Yanel is deployed inside the 
> ROOT context");
> +            contextPath = "/";
> +        }
> +        //log.debug("Context path: " + contextPath);
>
> but need to fix some more classes:
>
> src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources/DavCollection.java 
>
>
> src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources/showrealms/ShowRealms.java 
>
>
> src/webapp/src/java/org/wyona/yanel/servlet/security/impl/AutoLogin.java
>
> src/webapp/src/java/org/wyona/yanel/servlet/security/impl/DefaultWebAuthenticatorImpl.java 
>
>
> Will do this shortly.
>
> It's not 100% clear to me if the above fix is the most elegant, or if 
> one should rather use the context path of  the servlet context (which 
> is sometimes hard to access though).
>
> Thanks
>
> Michael



More information about the Yanel-development mailing list