Search in sources :

Example 6 with HttpServletResponseFilter

use of org.apache.cxf.jaxrs.impl.HttpServletResponseFilter in project cxf by apache.

the class HttpUtils method createServletResourceValue.

public static <T> T createServletResourceValue(Message m, Class<T> clazz) {
    Object value = null;
    if (clazz == HttpServletRequest.class) {
        HttpServletRequest request = (HttpServletRequest) m.get(AbstractHTTPDestination.HTTP_REQUEST);
        value = request != null ? new HttpServletRequestFilter(request, m) : null;
    } else if (clazz == HttpServletResponse.class) {
        HttpServletResponse response = (HttpServletResponse) m.get(AbstractHTTPDestination.HTTP_RESPONSE);
        value = response != null ? new HttpServletResponseFilter(response, m) : null;
    } else if (clazz == ServletContext.class) {
        value = m.get(AbstractHTTPDestination.HTTP_CONTEXT);
    } else if (clazz == ServletConfig.class) {
        value = m.get(AbstractHTTPDestination.HTTP_CONFIG);
    }
    return clazz.cast(value);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletConfig(javax.servlet.ServletConfig) HttpServletResponse(javax.servlet.http.HttpServletResponse) HttpServletResponseFilter(org.apache.cxf.jaxrs.impl.HttpServletResponseFilter) HttpServletRequestFilter(org.apache.cxf.jaxrs.impl.HttpServletRequestFilter)

Aggregations

HttpServletResponse (javax.servlet.http.HttpServletResponse)6 HttpServletResponseFilter (org.apache.cxf.jaxrs.impl.HttpServletResponseFilter)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)5 Message (org.apache.cxf.message.Message)5 Test (org.junit.Test)5 ServletContext (javax.servlet.ServletContext)4 Customer (org.apache.cxf.jaxrs.Customer)4 ThreadLocalHttpServletRequest (org.apache.cxf.jaxrs.impl.tl.ThreadLocalHttpServletRequest)4 ClassResourceInfo (org.apache.cxf.jaxrs.model.ClassResourceInfo)4 HttpServletRequestFilter (org.apache.cxf.jaxrs.impl.HttpServletRequestFilter)3 ServletConfig (javax.servlet.ServletConfig)2 ThreadLocalProxy (org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy)2 SingletonResourceProvider (org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)2 OperationResourceInfo (org.apache.cxf.jaxrs.model.OperationResourceInfo)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ThreadLocalServletConfig (org.apache.cxf.jaxrs.impl.tl.ThreadLocalServletConfig)1 PerRequestResourceProvider (org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider)1