title: No-thread bound request found
body: <p>Using Apache CXF dependency <code>cxf-rt-transports-http-jetty-3.1.4.jar</code> to test JAXRS services. Below are the Junit annotations-</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @WebAppConfiguration
  @ContextConfiguration(locations = {"classpath:test-spring-context.xml"})
  </code></pre>
  
  <p><strong>web.xml</strong> (don't think web.xml is loaded by <code>@WebAppConfiguration</code> but it's in standard directory src/main/webapp/WEB-INF/web.xml)</p>
  
  <pre><code>    &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;!-- listener to inject HttpServlet Request --&gt;
   &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;!-- CXF Servlet --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.cxf.transport.servlet.CXFServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>Jetty configuration</strong>-</p>
  
  <pre><code>&lt;httpj:engine-factory bus="cxf" id="port9191"&gt;
      &lt;httpj:engine port="9191"&gt;
          &lt;httpj:threadingParameters minThreads="5"
              maxThreads="15" /&gt;
          &lt;httpj:handlers&gt;
              &lt;bean class="org.eclipse.jetty.server.handler.DefaultHandler" /&gt;
          &lt;/httpj:handlers&gt;
          &lt;httpj:sessionSupport&gt;true&lt;/httpj:sessionSupport&gt;
      &lt;/httpj:engine&gt;
  &lt;/httpj:engine-factory&gt;
  </code></pre>
  
  <p>Getting below exception while trying to read header from <code>@Autowired HttpServletRequest request</code> object <code>request.getHeader("ApplicationName");</code>-</p>
  
  <pre><code>java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.web.context.support.WebApplicationContextUtils.currentRequestAttributes(WebApplicationContextUtils.java:309) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.web.context.support.WebApplicationContextUtils.access$400(WebApplicationContextUtils.java:64) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.web.context.support.WebApplicationContextUtils$RequestObjectFactory.getObject(WebApplicationContextUtils.java:325) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.web.context.support.WebApplicationContextUtils$RequestObjectFactory.getObject(WebApplicationContextUtils.java:320) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.beans.factory.support.AutowireUtils$ObjectFactoryDelegatingInvocationHandler.invoke(AutowireUtils.java:307) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  </code></pre>
  
  <p>Any help would be much appreciated!</p>