[
https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787410#action_12787410
]
Vincenzo Vitale commented on CXF-2471:
--------------------------------------
The response problem is fixed but now the Atom feed is not anymore rendered
properly.
I'm using a custom provider extending the
org.apache.cxf.jaxrs.provider.AtomFeedProvider. This was done since the xml
directive was not included in the final xml.
The custom provider is essentially this:
@Override
public void writeTo(Feed feed, Class<?> clazz, Type type, Annotation[] a,
MediaType mt, MultivaluedMap<String, Object> headers,
OutputStream os) throws IOException {
// System.out.println("requested media type: " + mt.toString());
if (!JSON_TYPE.equals(mt.toString())) {
os.write(XML_DIRECTIVE);
}
// System.out.println("going normal (atom)");
super.writeTo(feed, clazz, type, a, mt, headers, os);
}
and than configured in spring in the jax-rs section:
<jaxrs:server id="atomProductRestWebService" address="/product">
<jaxrs:serviceBeans>
<ref bean="atomProductWebService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="com.tomtom.csl.atom.AtomFeedProviderWithXMLDirective"
/>
</jaxrs:providers>
</jaxrs:server>
I guess is not related to this issue but just a regression (since I guess
2.2.6 is going to be backward compatible).
Thanks,
V.
> The HttpServletResponse statuses is lost after is set in a service
> implementation (where the response is injected through @Context).
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-2471
> URL: https://issues.apache.org/jira/browse/CXF-2471
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.2.4
> Reporter: Vincenzo Vitale
> Assignee: Sergey Beryozkin
> Fix For: 2.2.5, 2.3
>
>
> After injecting the the HttpServletResponse with the @Context annotation:
> @POST
> @Path("/login")
> public Feed login(@FormParam("username") String username,
> @FormParam("password") String password,
> @Context HttpServletResponse httpServletResponse)
> and than setting a status code (for example 401 if the user is not
> authorized), the status code get lost.
> See here for workarounds and more detials:
> http://www.nabble.com/Setting-the-status-code-in-the-injected-(via-the-jax-...@context)--HttpServletResponse-td25883621.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.