Hi Mark,

Mark Derricutt schrieb:
> This approach sounds reasonable - is there a SNAPSHOT bundle I can pull in
> with this applied at all?  If not, I'll pull out the sling code and apply
> the patch locally to confirm everything works locally here.

No there is no SNAPSHOT yet. I just created SLING-736 and attached a
slightly modified patch which includes hard-coding the path of the
SlingMainServlet.

If you could grab the code and apply the patch for testing, this would
be cool ! Thanks alot. Otherwise just drop me a node and I can send it
to you off-list.

Regards
Felix

> 
> On Mon, Nov 17, 2008 at 2:44 AM, Felix Meschberger <[EMAIL PROTECTED]>wrote:
> 
> 
>> * The SlingMainServlet is always registered with the HttpService with
>> the servlet path "/". This cannot be configurable.
>> * The SlingHttpServletRequestImpl, which is instantiated by the
>> SlingMainServlet to provide the SlingHttpServletRequest interface, is
>> modified to overwrite the getServletPath() and getPathInfo() methods as
>> follows (see also Section SRV.4.4 in Servlet API 2.4 spec) :
>>   * getServletPath() always returns ""
>>   * getPathInfo() always returns the getServletPath()+getPathInfo()
>>        called on the servlet container (or HttpService provided)
>>        HttpServletRequest object
>>
>> This should reproduce the behaviour of registering the SlingMainServlet
>> as "/*" no matter how the HttpService would handle this. See the
>> proposed patch attached below.
>>
>> WDYT ?
>>
>> BTW: We had a similar issue running a modified Sling Web App in Weblogic
>> 9, where getPathInfo() return null even though the request URL was not
>> addressed at the Servlet itself. This may be related.
>>
>>
>> Regards
>> Felix
>>
>> [1] http://www.mail-archive.com/[EMAIL PROTECTED]/msg00440.html
>>
>>
>> Proposed patch:
>>
>> Index:
>>
>> /usr/src/sling/head/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
>> ===================================================================
>> ---
>>
>> /usr/src/sling/head/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
>> (revision 713054)
>> +++
>>
>> /usr/src/sling/head/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
>> (working copy)
>> @@ -59,6 +59,7 @@
>>         SlingHttpServletRequest {
>>
>>     private final RequestData requestData;
>> +    private final String pathInfo;
>>     private String responseContentType;
>>
>>     public SlingHttpServletRequestImpl(RequestData requestData,
>> @@ -65,6 +66,13 @@
>>             HttpServletRequest servletRequest) {
>>         super(servletRequest);
>>         this.requestData = requestData;
>> +
>> +        // prepare the pathInfo property
>> +        String pathInfo = servletRequest.getServletPath();
>> +        if (servletRequest.getPathInfo() != null) {
>> +            pathInfo = pathInfo.concat(servletRequest.getPathInfo());
>> +        }
>> +        this.pathInfo = pathInfo;
>>     }
>>
>>     /**
>> @@ -275,6 +283,25 @@
>>     }
>>
>>     /**
>> +     * Always returns the empty string since the actual servlet
>> registered with
>> +     * the servlet container (the HttpService actually) is registered as
>> if
>> +     * the servlet path is "/*".
>> +     */
>> +    @Override
>> +    public String getServletPath() {
>> +        return "";
>> +    }
>> +
>> +    /**
>> +     * Returns the part of the request URL without the leading servlet
>> context
>> +     * path.
>> +     */
>> +    @Override
>> +    public String getPathInfo() {
>> +        return pathInfo;
>> +    }
>> +
>> +    /**
>>      * A <code>UserPrincipal</code> ...
>>      */
>>     private static class UserPrincipal implements Principal, Serializable {
>>
>>> Mark
>>>
>>>
>>> On Wed, Nov 12, 2008 at 10:14 AM, Bertrand Delacretaz <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>> On Tue, Nov 11, 2008 at 9:34 PM, Mark Derricutt <[EMAIL PROTECTED]>
>> wrote:
>>>>> ....We've raised a ticket over at OPS4J and
>>>>> the issue is scheduled for a 0.5.2 release:..
>>>> Cool, thanks for the info!
>>>> -Bertrand
>>>>
>>>
>>>
> 
> 
> 

Reply via email to