@Override
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
// delegate the request to the registered delegatee servlet
Servlet delegatee = sling;
if (delegatee != null) {
// check for problematic application servers like WebSphere
// where path info and servlet path is set wrong SLING-2410
final HttpServletRequest request = (HttpServletRequest) req;
if ( request.getPathInfo() == null && request.getServletPath() != null
&& request.getServletPath().endsWith(".jsp") ) {
req = new HttpServletRequestWrapper(request) {
@Override
public String getPathInfo() {
return request.getServletPath();
}
@Override
public String getServletPath() {
return "";
}
};
}
delegatee.service(req, res);
} else if (startFailureCounter > MAX_START_FAILURES) {
// too many startup retries, fail for ever
((HttpServletResponse) res).sendError(HttpServletResponse.SC_NOT_FOUND);