Search in sources :

Example 1 with UriInfoImpl

use of org.apache.cxf.jaxrs.impl.UriInfoImpl in project camel by apache.

the class CxfRsInvoker method prepareExchange.

private org.apache.camel.Exchange prepareExchange(Exchange cxfExchange, Method method, Object[] paramArray, Object response) {
    ExchangePattern ep = ExchangePattern.InOut;
    if (method.getReturnType() == Void.class) {
        ep = ExchangePattern.InOnly;
    }
    final org.apache.camel.Exchange camelExchange = endpoint.createExchange(ep);
    if (response != null) {
        camelExchange.getOut().setBody(response);
    }
    CxfRsBinding binding = endpoint.getBinding();
    binding.populateExchangeFromCxfRsRequest(cxfExchange, camelExchange, method, paramArray);
    // the CXF in message property. Question: where should this property name be set up ? 
    if (endpoint.isPropagateContexts()) {
        camelExchange.setProperty(UriInfo.class.getName(), new UriInfoImpl(cxfExchange.getInMessage()));
        camelExchange.setProperty(Request.class.getName(), new RequestImpl(cxfExchange.getInMessage()));
        camelExchange.setProperty(HttpHeaders.class.getName(), new HttpHeadersImpl(cxfExchange.getInMessage()));
        camelExchange.setProperty(SecurityContext.class.getName(), new SecurityContextImpl(cxfExchange.getInMessage()));
    }
    return camelExchange;
}
Also used : HttpHeaders(javax.ws.rs.core.HttpHeaders) SecurityContextImpl(org.apache.cxf.jaxrs.impl.SecurityContextImpl) Request(javax.ws.rs.core.Request) HttpHeadersImpl(org.apache.cxf.jaxrs.impl.HttpHeadersImpl) ExchangePattern(org.apache.camel.ExchangePattern) SecurityContext(javax.ws.rs.core.SecurityContext) UriInfo(javax.ws.rs.core.UriInfo) RequestImpl(org.apache.cxf.jaxrs.impl.RequestImpl) UriInfoImpl(org.apache.cxf.jaxrs.impl.UriInfoImpl)

Aggregations

HttpHeaders (javax.ws.rs.core.HttpHeaders)1 Request (javax.ws.rs.core.Request)1 SecurityContext (javax.ws.rs.core.SecurityContext)1 UriInfo (javax.ws.rs.core.UriInfo)1 ExchangePattern (org.apache.camel.ExchangePattern)1 HttpHeadersImpl (org.apache.cxf.jaxrs.impl.HttpHeadersImpl)1 RequestImpl (org.apache.cxf.jaxrs.impl.RequestImpl)1 SecurityContextImpl (org.apache.cxf.jaxrs.impl.SecurityContextImpl)1 UriInfoImpl (org.apache.cxf.jaxrs.impl.UriInfoImpl)1