Servlet not getting invoked using osgi.service.http.whiteboard pattern

254 Views Asked by At

Currently i am working on an issue where if content-type format is invalid (type/subtype , where "/" is missing), jetty sends response back as 400. I need to customize the error message using whiteboard pattern (osgi.service.http.whiteboard). I registered a new servlet with the errorpage pattern as "400" like the following:

@Component(
    service=Servlet.class,
    property= {
        "osgi.http.whiteboard.servlet.errorPage=java.lang.IllegalArgumentException",
        "osgi.http.whiteboard.servlet.errorPage=400"
    },
scope=ServiceScope.PROTOTYPE)
public class ErrorServlet extends HttpServlet{}

However I am facing the issue that is: in spite of an error code "400" sent from Jetty my servlet(ErrorServlet) is not getting called to handle it.

0

There are 0 best solutions below