Hi Robert

Have you tried "forwarding" instead of "including"? AFAIK that should
clear any previous reuest path info etc.

Regards
Julian

On Thu, Sep 26, 2019 at 4:54 PM Robert Munteanu <[email protected]> wrote:
>
> On Thu, 2019-09-26 at 13:32 +0200, Radu Cotescu wrote:
> > Hi Robert,
> >
> > > On 26 Sep 2019, at 13:08, Robert Munteanu <[email protected]>
> > > wrote:
> > >
> > >
> > > My solution has two steps:
> > >
> > > 1. wrap the original request using a SlingHttpServletRequestWrapper
> > > and
> > > overriding getResource() to return the new resource. Also
> > > overriding
> > > getRequestPathInfo to return an object that points to the new
> > > resource
> > >
> > > 2. obtain a reference to the DefaultGetServlet via
> > >
> > > @Reference(target =
> > > "(component.name=org.apache.sling.servlets.get.DefaultGetServlet)")
> > > private Servlet getServlet;
> > >
> > > (I guess I could use the component pid as a slight improvement).
> > >
> > > and invoke its service() method with the altered request and the
> > > same response.
> > >
> >
> > Why can’t you use the RequestDispatcher in the second step instead of
> > directly referencing the DefaultGetServlet?
>
> Good question :-) There are two answers to this:
>
> 1. I did not think of that
> 2. It does not allow me to override the extension. But that should be a
> simple change. So I filed
>
>   https://issues.apache.org/jira/browse/SLING-8742
>
> to allow overriding the extension when including a resource.
>
> Thanks,
> Robert
>

Reply via email to