Hi Robert
As Radu says - that could be as simple as this:
String suffix = request.getRequestPathInfo().getSuffix();
request
.getRequestDispatcher("/content/maven" + suffix)
.forward(request, response);
The newly dispatched request then goes through servlet resolution
again and has a fair chance of ending up with the default GET servlet.
And you can influence this selection further by adding
RequestDispatcherOptions to force e.g. the default resource type
"sling/servlet/default".
Regards
Julian
On Thu, Sep 26, 2019 at 1:32 PM Radu Cotescu <[email protected]> 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?
>
> Cheers,
> Radu
>