Examples of HttpHeadersImpl


Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

    }

    private static Object processCookieParam(Message m, String cookieName,
                              Class<?> pClass, Type genericType,
                              Annotation[] paramAnns, String defaultValue) {
        Cookie c = new HttpHeadersImpl(m).getCookies().get(cookieName);
       
        if (c == null && defaultValue != null) {
            c = Cookie.valueOf(cookieName + '=' + defaultValue);
        }
        if (c == null) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

   
    private static Object createHttpHeaders(Message m, Class<?> ctxClass) {
        if (MessageUtils.isRequestor(m)) {
            m = m.getExchange() != null ? m.getExchange().getOutMessage() : m;
        }
        return HttpHeaders.class.isAssignableFrom(ctxClass) ? new HttpHeadersImpl(m)
            : new ProtocolHeadersImpl(m);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

                                         parameterAnnotations,
                                         type,
                                         m);
            if (provider != null) {
                try {
                    HttpHeaders headers = new HttpHeadersImpl(m);
                    return provider.readFrom(
                              targetTypeClass, parameterType, parameterAnnotations, contentType,
                              headers.getRequestHeaders(), is);
                } catch (IOException e) {
                    throw e;
                } catch (WebApplicationException ex) {
                    throw ex;
                } catch (Exception ex) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

    }
   
    public static String getProtocolHeader(Message m, String name, String defaultValue, boolean setOnMessage) {
        String value = (String)m.get(name);
        if (value == null) {
            value = new HttpHeadersImpl(m).getRequestHeaders().getFirst(name);
            if (value != null && setOnMessage) {
                m.put(name, value);
            }
        }
        return value == null ? defaultValue : value;
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

        if (ignoreRequests) {
            return Response.status(404).build();
        }

        HttpHeaders headers = new HttpHeadersImpl(m);
        List<MediaType> accepts = headers.getAcceptableMediaTypes();
        MediaType type = accepts.contains(WADL_TYPE) ? WADL_TYPE : accepts
            .contains(MediaType.APPLICATION_JSON_TYPE) ? MediaType.APPLICATION_JSON_TYPE : defaultMediaType;

        Response response = getExistingWadl(m, ui, type);
        if (response != null) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

            return handleAuthenticationException(ex, m);
        }
    }

    protected Response handleAuthenticationException(SecurityException ex, Message m) {
        HttpHeaders headers = new HttpHeadersImpl(m);
        if (redirectURI != null && isRedirectPossible(headers)) {
           
            URI finalRedirectURI = null;
    
            if (!redirectURI.isAbsolute()) {
                String endpointAddress = HttpUtils.getEndpointAddress(m);
                Object basePathProperty = m.get(Message.BASE_PATH);
                if (ignoreBasePath && basePathProperty != null && !"/".equals(basePathProperty)) {
                    int index = endpointAddress.lastIndexOf(basePathProperty.toString());
                    if (index != -1) {
                        endpointAddress = endpointAddress.substring(0, index);
                    }
                }
                finalRedirectURI = UriBuilder.fromUri(endpointAddress).path(redirectURI.toString()).build();
            } else {
                finalRedirectURI = redirectURI;
            }
           
            return Response.status(getRedirectStatus()).
                    header(HttpHeaders.LOCATION, finalRedirectURI).build();
        } else {
            ResponseBuilder builder = Response.status(Response.Status.UNAUTHORIZED);
           
            StringBuilder sb = new StringBuilder();
           
            List<String> authHeader = headers.getRequestHeader(HttpHeaders.AUTHORIZATION);
            if (authHeader.size() > 0) {
                // should HttpHeadersImpl do it ?
                String[] authValues = StringUtils.split(authHeader.get(0), " ");
                if (authValues.length > 0) {
                    sb.append(authValues[0]);
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

    public <T> ContextResolver<T> createContextResolver(Type contextType,
                                                        Message m) {
        boolean isRequestor = MessageUtils.isRequestor(m);
        Message requestMessage = isRequestor ? m.getExchange().getOutMessage()
                                             : m.getExchange().getInMessage();
        HttpHeaders requestHeaders = new HttpHeadersImpl(requestMessage);
        MediaType mt = null;
       
        Message responseMessage = isRequestor ? m.getExchange().getInMessage()
                                              : m.getExchange().getOutMessage();
        if (responseMessage != null) {
            Object ctProperty = responseMessage.get(Message.CONTENT_TYPE);
            if (ctProperty == null) {
                List<MediaType> accepts = requestHeaders.getAcceptableMediaTypes();
                if (accepts.size() > 0) {
                    mt = accepts.get(0);
                }
            } else {
                mt = JAXRSUtils.toMediaType(ctProperty.toString());
            }
        } else {
            mt = requestHeaders.getMediaType();
        }
       
        return createContextResolver(contextType, m,
               mt == null ? MediaType.WILDCARD_TYPE : mt);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

                                             Class<?> pClass,
                                             Type genericType,
                                             Annotation[] paramAnns,
                                             String defaultValue) {
       
        List<String> values = new HttpHeadersImpl(m).getRequestHeader(header);
        if (values != null && values.isEmpty()) {
            values = null;
        }
        return InjectionUtils.createParameterObject(values,
                                                    pClass,
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

    }

    private static Object processCookieParam(Message m, String cookieName,
                              Class<?> pClass, Type genericType,
                              Annotation[] paramAnns, String defaultValue) {
        Cookie c = new HttpHeadersImpl(m).getCookies().get(cookieName);
       
        if (c == null && defaultValue != null) {
            c = Cookie.valueOf(cookieName + '=' + defaultValue);
        }
        if (c == null) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.HttpHeadersImpl

   
    private static Object createHttpHeaders(Message m, Class<?> ctxClass) {
        if (MessageUtils.isRequestor(m)) {
            m = m.getExchange() != null ? m.getExchange().getOutMessage() : m;
        }
        return HttpHeaders.class.isAssignableFrom(ctxClass) ? new HttpHeadersImpl(m)
            : new ProtocolHeadersImpl(m);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.