How can I decorate a HttpServlet?

76 Views Asked by At

I need to make a wrapper class for HttpServlet. The problem is that the doX methods are protected and for this reason i can't apply any delegator unless i create some kind of HttpServletWithPublicMethods extends HttpServlet subclass (Which i don't want to).

The intended usage is the following:

servletContext.addServlet("myServletName", new HttpServletWrapper(myServlet))

Is there any way to circumvent this? I guess calling Method#invoke would be costly in this case.

0

There are 0 best solutions below