hi Oliver,

thanks a lot for your reply

On Apr 3, 2014, at 7:09 PM, Oliver Lietz 
<[email protected]<mailto:[email protected]>> wrote:

On Thursday 03 April 2014 16:12:47 Antonio Sanso wrote:
hi *,

hello Antonio,

SLING-722 introduced an important fix to solve some issue related to sling
being registered in a Servlet container. Unluckily this fix has been
removed in SLING-2998.

do you mean the following lines?

-        String pathInfo = request.getPathInfo();
-        if (pathInfo == null || pathInfo.length() == 0) {
-            pathInfo = "/“;

correct



Which problem do you see?


the problem with the current code is

private String getPath(HttpServletRequest request) {
        final StringBuilder sb = new StringBuilder();
        if (request.getServletPath() != null) {
            sb.append(request.getServletPath());
        }
        if (request.getPathInfo() != null) {
            sb.append(request.getPathInfo());
        }
        return sb.toString();
    }


that if I deploy slinging a servlet container (e.g. web logic ) using 
contextPath ‘test' and requesting http://localhost:4502/test getPath() returns 
an empty string and this leads to getAnonymousCredentials();

IMHO this is wrong behavior (the correct one would be to include as well the 
old piece of code).

WDYT?

regards

antonio


The rationale behind this is not too clear to me. I am not against
SLING-2998 per se. I think though that SLING-2998 should also contain the
fix contained in SLING-722.

@oliver WDYT?

Did you read the thread on 
[email protected]<mailto:[email protected]> [2]? I did some research
back in 2013 and found a blog post [3] with a solution for my problem: "Good
old Cocoon fixes this by simply concatenating the path info and servlet path,
so that your application doesn't have to care about it."

This was tested on Sling [4] and CQ and worked well.

regards

antonio

hth,
O.

[0] https://issues.apache.org/jira/browse/SLING-722
[1] https://issues.apache.org/jira/browse/SLING-2998

[2] http://mail-archives.apache.org/mod_mbox/sling-
users/201308.mbox/<[email protected]<mailto:[email protected]>>
[3] http://bluxte.net/musings/2006/03/29/servletpath-and-pathinfo-servlet-api-
weirdness
[4] https://github.com/oliverlietz/sling-
tests/tree/master/org.apache.sling.tests/SLING-2998


Reply via email to