3 Replies Latest reply on Feb 1, 2013 5:55 AM by Nicklas Karlsson

    PreProcessInterceptor: @Context vs. HttpRequest parameter

    Michael Steffens Newbie

      In order perform basic authentication I need to access HTTP request header from preProcess method of a PreProcessInterceptor.

       

      There seem to be two ways to access these:

      1. A @Context annotated injection of HttpServletRequest instance
      2. The HttpRequest parameter of the preProcess method

       

      Most code examples I have come across are using the injected context value, while the parameter looks more straighforward to me.

       

      Is the any reason to prefer one over the other? Is it possible that they ever don't expose the same set of request headers?

       

      Thanks in advance!