cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdelgadiri (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-4986) jax-rs2 request filter is unable to modify request header by adding a new header
Date Thu, 25 Apr 2013 10:18:15 GMT
abdelgadiri created CXF-4986:
--------------------------------

             Summary: jax-rs2 request filter is unable to modify request header by adding
a new header 
                 Key: CXF-4986
                 URL: https://issues.apache.org/jira/browse/CXF-4986
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.7.2
         Environment: cxf on tomcat
            Reporter: abdelgadiri


I have a filter implementation as follows

@Provider
public class AuthSessionFilter implements ContainerRequestFilter {
    public AuthSessionFilter() {
    }

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {      

        Object sessionId = requestContext.getProperty("sessionId");
        if (sessionId == null || GeneralUtils.isNullOrBlank(sessionId + "")) {
            requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED)
                    .entity("missing sessionId").build());
        }

        requestContext.getHeaders().putSingle("sessionId", sessionId+"");
    }
}


The line requestContext.getHeaders().putSingle("sessionId", sessionId+""); is not making the
added sessionId header available when trying to obtain it from my resource. getHeaders() is
supposed to return a mutable map in accordance with the spec, but its implementation 'ContainerRequestContextImpl'
is returning a readonly map instead. it returning:

  return new MetadataMap<String, String>(
            (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS), false,
true, true);

where it is passing 'true' for the readonly parameter.




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message