> > If you register an own Servlet which should be used as
> default servlet you can register it with
> >
> > sling.servlet.resourceTypes=sling/servlet/default
> > sling.servlet.methods=GET
> > (if it should work only for GET requests)
> >
> > If I upload a bundle with such a Servlet (call it
> > MyServlet) in Sling everything seems to be fine, the GET
> > requests are dispatched by the MyServlet. But after a restart
> > of Sling it's a random luck which Servlet (the
> > DefaultGetServlet or the MyServlet) will dispatch the
> > request. Shouldn't there be a way to mark a Servlet as the
> > one with higher priority. There is the getWeightedResources
> > method on the ResourceCollector, but this doesn't help,
> > because neither Servlet has more "weight". In my case I would
> > like to install a Servlet which implements the OptingServlet
> > and gets all requests first to decide if the
> > DefaultGetServlet should handle the request or if it should
> > be handled by the MyServlet itself.
>
> Frankly, this ain't gonna work: you cannot reliably register two
> servlets with the same setup. For this reason you can only replace the
> DefaultGetServlet by removing the o.a.sling.serlvets.get bundle.
>
> I presume, that this is not an option, though ;-)
>
> Now my question is: what functionality do you implement in
> your special
> generic GET servlet, which is missing from the Sling
> DefaultGetServlet.
> Could there be a chance of plugging your required
> functionality into the
> DefaultGetServlet ?
>
> Another option would be that you create your own servlet
> extending from
> the DefaultGetServlet. You then create a bundle with your own code
> merged with the contents of the o.a.sling.servlets.get bundle and only
> install your own bundle. But I suggest, we first explore the
> first option.

Hi Felix

What I try tio achieve is run some legacy stuff shoulder to shoulder with
new stuff which entirely is built on Sling. So the MyServlet (or call it
LegacyServlet) should check (as OptingServlet) if the request is a call
to the legacy stuff and handle it in this case. If not, accepts() on the
LegacyServlet should return false and the request should be handled by the
default Servlets of Sling (or any other registered Servlet for the request).
So plugging in the functionality to the existing DefaultGetServlet and the
SlingPostServlet is probably not the solution.
Extending from the existing default Servlets seems to fit better in this case.
Maybe also Filters could help in this case, but as far as I understood filters
are not preprocessed in a Sling standalone app, so the solution with filters
would be bound to using Sling in a Servlet container (which I do not prefer!).

is there any other possability?

best regards
mike

Reply via email to