Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.
This repository was archived by the owner on May 28, 2018. It is now read-only.

Injecting HttpServletRequest in jersey-test-*provider via @Context when inside a @Provider like ContextRequestFilter fails #2916

@glassfishrobot

Description

@glassfishrobot

Consider this simple code:

@Provider
public class RestRequestFilter implements ContainerRequestFilter {

    private static final Logger logger = LogManager.getLogger(RestRequestFilter.class);

    @Context
    private HttpServletRequest httpRequest;

    @Override
    public void filter(ContainerRequestContext request) throws IOException {
        logger.info("request: " + httpRequest);
    }
}

you will see, that this is null, when run in inmemory/grizzly2/jetty providers for tests. However, it is injected correctly, when run in a real servlet container like jetty/tomcat.

Can someone point me to the right solution for this issue?

Thanks in advance,
Yusuf

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions