Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-396

Unable to inject contextual data of type: javax.ws.rs.core.HttpHeaders

    Details

      Description

      I created an ExeptionMapper :
      @Provider
      public class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> {

      private static final Logger LOG = Logger.getLogger(NotFoundExceptionMapper.class);
      @Context
      HttpHeaders httpHeaders;

      /*

      • (non-Javadoc)
      • @see javax.ws.rs.ext.ExceptionMapper#toResponse(java.lang.Throwable)
        */
        @Override
        public Response toResponse(final NotFoundException exception) { // TODO add to docs: INTERNAL_SERVER_ERROR LOG.error("Exception is being handled by NotFoundExceptionMapper"); LOG.error(exception.getMessage()); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).type(httpHeaders.getMediaType().toString()).build(); }

        }

      When I try to access non-existant url I got the following stacktrace :
      SEVERE: Servlet.service() for servlet Resteasy threw exception
      org.jboss.resteasy.spi.LoggableFailure: Unable to inject contextual data of type: javax.ws.rs.core.HttpHeaders
      at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:53)
      at $Proxy16.getRequestHeader(Unknown Source)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  bill.burke Bill Burke
                  Reporter:
                  pmilczar Piotr Milczarek
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: