On Thursday, February 16, 2012 1:54:58 PM Nathaniel Auvil wrote: > thanks for the reply, but this example is from a client point of view. I > need to access http header on the server side, specifically the response. > From code, how do i get access to the RequestContext/ResponseContext or > something like that? My wsdl to java generated server stubs only accept > the XML types going in and out. >
It should be roughly the same. If you have the injected context, you can do: ctx.get(MessageContext.HTTP_RESPONSE_HEADERS) and add the headers. However, it sounds like you want the response code, not headers, right? Thus, just do: ctx.put(MessageContext.HTTP_RESPONSE_CODE, "555") or similar. Dan > On Thu, Feb 16, 2012 at 1:49 PM, Glen Mazza <[email protected]> wrote: > > http://java.dzone.com/**articles/apache-cxf-how-add-**custom-http<http://j > > ava.dzone.com/articles/apache-cxf-how-add-custom-http> ? > > > > HTH, > > Glen > > > > On 02/16/2012 12:48 PM, Nathaniel Auvil wrote: > >> i generated server stubs from WSDL. I have a use case where i need to be > >> able to set the HTTP Status code in responses is certain error > >> conditions. > >> How do i get a handle to the HTTP response in my SOAP based service which > >> has the JAXB objects as input and outputs? > >> > >> For the WS-Addressing header info i inject the WebServiceContext in my > >> bean > >> so i can access that. I seem to remember there being a RequestContext > >> object in CXF at some point which used thread local to get the current > >> context and allowed for HTTP Header access request and response, but i do > >> not see that in 2.5.1 > >> > >> Any help is greatly appreciated. > > > > -- > > Glen Mazza > > Talend Community Coders - coders.talend.com > > blog: www.jroller.com/gmazza -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
