Package javax.ws.rs.core

Examples of javax.ws.rs.core.HttpHeaders


        when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
        when(mockHttpRequest.getHttpHeaders()).thenReturn(mockHttpHeaders);
    }

    private void mockShouldNotTraceHttpHeaders() {
        final HttpHeaders mockHttpHeaders = mock(HttpHeaders.class);
        final MultivaluedMapImpl<String, String> multivaluedMapImpl = new MultivaluedMapImpl<String, String>();
        multivaluedMapImpl.add(BraveHttpHeaders.Sampled.getName(), "false");
        when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
        when(mockHttpRequest.getHttpHeaders()).thenReturn(mockHttpHeaders);
    }
View Full Code Here


                                         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) {
                    String errorMessage = "Error deserializing input stream into target class "
                                          + targetTypeClass.getSimpleName()
                                           + ", content type : " + contentType;
                    LOG.severe(errorMessage);
View Full Code Here

        return responseOfOk(renderer, Caching.ONE_DAY).build();
    }

    private void fakeRuntimeExceptionIfXFail() {
        final HttpHeaders httpHeaders = getResourceContext().getHttpHeaders();
        if (httpHeaders.getRequestHeader("X-Fail") != null) {
            throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_FAILURE);
        }
    }
View Full Code Here

            if (runtimeContext == null) {
                return null;
            }

            // for all headers
            HttpHeaders httpHeaders = runtimeContext.getHttpHeaders();
            List<String> values = httpHeaders.getRequestHeader(getName());
            if (values == null) {
                values = new LinkedList<String>();
            }
            if (values.size() == 0 && hasDefaultValue()) {
                values.add(getDefaultValue());
View Full Code Here

        public Object getValue(RuntimeContext runtimeContext) throws IOException {
            if (runtimeContext == null) {
                return null;
            }
            String value = null;
            HttpHeaders httpHeaders = runtimeContext.getHttpHeaders();
            Map<String, Cookie> values = httpHeaders.getCookies();

            Cookie cookie = null;
            if (values.size() > 0) {
                cookie = values.get(getName());
            }
View Full Code Here

        sbMain.append(sbResources.toString());
        sbMain.append("</application>");
       
        m.getExchange().put(JAXRSUtils.IGNORE_MESSAGE_WRITERS, ignoreMessageWriters);
       
        HttpHeaders headers = new HttpHeadersImpl(m);
        MediaType type = headers.getAcceptableMediaTypes().contains(MediaType.APPLICATION_XML_TYPE)
                      ? MediaType.APPLICATION_XML_TYPE : WADL_TYPE; 
        return Response.ok().type(type).entity(sbMain.toString()).build();
    }
View Full Code Here

     * @param context the context of the current request
     * @return
     */
    private MethodRecord selectBestMatchingMethod(List<? extends MethodRecord> methodRecords,
                                                  RuntimeContext context) {
        HttpHeaders httpHeaders = context.getHttpHeaders();
        MediaType inputMediaType = httpHeaders.getMediaType();
        List<MediaType> acceptableMediaTypes = httpHeaders.getAcceptableMediaTypes();

        MethodRecord bestMatch = null;
        for (MethodRecord record : methodRecords) {
            if (compareMethods(record, bestMatch, inputMediaType, acceptableMediaTypes) > 0) {
                bestMatch = record;
View Full Code Here

     * @param context the context of the current request
     * @return
     */
    private MethodRecord selectBestMatchingMethod(List<? extends MethodRecord> methodRecords,
                                                  RuntimeContext context) {
        HttpHeaders httpHeaders = context.getHttpHeaders();
        MediaType inputMediaType = httpHeaders.getMediaType();
        List<MediaType> acceptableMediaTypes = httpHeaders.getAcceptableMediaTypes();

        MethodRecord bestMatch = null;
        for (MethodRecord record : methodRecords) {
            if (compareMethods(record, bestMatch, inputMediaType, acceptableMediaTypes) > 0) {
                bestMatch = record;
View Full Code Here

            if (runtimeContext == null) {
                return null;
            }

            // for all headers
            HttpHeaders httpHeaders = runtimeContext.getHttpHeaders();
            List<String> values = httpHeaders.getRequestHeader(getName());
            if (values == null) {
                values = new LinkedList<String>();
            }
            if (values.size() == 0 && hasDefaultValue()) {
                values.add(getDefaultValue());
View Full Code Here

        public Object getValue(RuntimeContext runtimeContext) throws IOException {
            if (runtimeContext == null) {
                return null;
            }
            String value = null;
            HttpHeaders httpHeaders = runtimeContext.getHttpHeaders();
            Map<String, Cookie> values = httpHeaders.getCookies();

            Cookie cookie = null;
            if (values.size() > 0) {
                cookie = values.get(getName());
            }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.HttpHeaders

Copyright © 2018 www.massapicom. 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.