I'd like to wrap the HttpSession and have it be injectable via the @Context
parameter. I thought something like:

{code}
@Provider
public class UserSessionProvider implements ContextResolver<UserSession> {

    @Context
    private Providers providers;

    @Override
    public UserSession getContext(Class<?> type) {
        ContextResolver<HttpServletRequest> requestContextResolver =
providers.getContextResolver(HttpServletRequest.class,
MediaType.WILDCARD_TYPE);
        if (requestContextResolver != null) {
            HttpServletRequest request =
requestContextResolver.getContext(type);
            return new UserSession(request.getSession(true));
        }
        return null;
    }
}
{code}

would do the trick, but I get nothing. Though this class was added to the
Application.getClasses() as far as I can tell the provider is never even
being constructed or called.

Any ideas?
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to