Hi Mike, Mike Müller schrieb: > Hi > > 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. Regards Felix
