Mattias Holmqvist
Mattias Holmqvist

Reputation: 832

Interceptor in @WebServlet not activated

We have a @WebServlet that's annotated with a custom interceptor annotation like this:

@WebServlet("/path")
@CustomInterceptor
public class InitialHtmlServlet extends HttpServlet
{
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
  {
  }
}

We have the CustomInterceptor in the beans.xml in /WEB-INF and the interceptor works in other CDI-components. In this servlet, however, we cannot get it working.

We're running the latest JBoss EAP, which should be somewhat similar to JBoss 7.1.1. Is there something we should do different to get the interceptor to catch invocations on the servlet or is this not possible at all?

Upvotes: 3

Views: 1048

Answers (1)

Tair
Tair

Reputation: 3809

After some digging around I also found it somewhat confusing, that while being a good candidate for calling it a 'bean', servlet are exempt from interceptor mechanism.

It looks like various parts of JEE6 may or may not support interceptors at will :). Found some discussion here.

Upvotes: 4

Related Questions