I've just had a go at patching the jax-rs extension to address this issue.

The issue is marked as STARTED but I couldn't see any code in trunk that 
indicates a solution yet.  In case it helps I'd like to post the few lines of 
code I added to make it work:

I added the following to the botton of method: jaxRsRespToRestletResp() in 
class: JaxRsRestlet

        // Support for extension header returns from jax-rs resources: see 
http://restlet.tigris.org/issues/show_bug.cgi?id=913
        @SuppressWarnings("unchecked")
                Series<Parameter> extensionHeaders = 
(Series<Parameter>)httpHeaders.getFirst(HeaderConstants.ATTRIBUTE_HEADERS);
        if( null != extensionHeaders ){
                Map<String, Object> attributes = new HashMap<String, Object>();
                attributes.put(HeaderConstants.ATTRIBUTE_HEADERS, 
extensionHeaders);
                restletResponse.setAttributes(attributes);
        }

With this in place I can specify extension response headers like this:

            ResponseBuilder builder = Response.ok(null, 
MediaType.APPLICATION_JSON);
            Series<Parameter> xheaders = new Form();
            xheaders.add(new Parameter("X-Hello", "world"));
            builder.header( HeaderConstants.ATTRIBUTE_HEADERS, xheaders );
            return builder.build();

Any and all feedback welcomed  :-)


Simon

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2681060

Reply via email to