Examples of InBoundHeaders


Examples of com.sun.jersey.core.header.InBoundHeaders

  private void adjustHeader(ContainerRequest request, String path, String suffix) {
    String mime = SUFFIXES.get(suffix);
   
    // change accept header
    InBoundHeaders headers = (InBoundHeaders) request.getRequestHeaders();
    headers.put(HttpHeaders.ACCEPT, Collections.singletonList(mime));
    request.setHeaders(headers);
   
    // remove suffix from the URL
    String newPath = path.substring(0, path.length() - suffix.length());
    URI requestUri = request.getRequestUri();
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

    }

    public ClientResponse handle(ClientRequest clientRequest) {
        byte[] requestEntity = writeRequestEntity(clientRequest);

        InBoundHeaders rh = getInBoundHeaders(clientRequest.getMetadata());

        final ContainerRequest cRequest = new ContainerRequest(
                w,
                clientRequest.getMethod(),
                baseUri,
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

        clientResponse.getProperties().put("response.entity", responseEntity);
        return clientResponse;
    }

    private InBoundHeaders getInBoundHeaders(MultivaluedMap<String, Object> outBound) {
        InBoundHeaders inBound = new InBoundHeaders();

        for (Map.Entry<String, List<Object>> e : outBound.entrySet()) {
            for (Object v : e.getValue()) {
                inBound.add(e.getKey(), ClientRequest.getHeaderValue(v));
            }
        }

        return inBound;
    }
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

            throw new IllegalArgumentException(ex);
        }
    }

    private InBoundHeaders getHeaders(Request request) {
        InBoundHeaders header = new InBoundHeaders();

        List<String> names = request.getNames();
        for (String name : names) {
            String value = request.getValue(name);
            header.add(name, value);
        }

        return header;
    }
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

            throw new IllegalArgumentException(ex);
        }
    }
   
    private InBoundHeaders getHeaders(Request request) {
        InBoundHeaders header = new InBoundHeaders();
       
        List<String> names = request.getNames();
        for (String name : names) {
            String value = request.getValue(name);
            header.add(name, value);
        }
       
        return header;
    }
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

            InternetHeaders headers = parseHeaders(ds);
            InputStream content = parseEntity(ds);

            if (status.getStatus() >= HTTP_ERROR) {

                InBoundHeaders inBoundHeaders = new InBoundHeaders();
                @SuppressWarnings("unchecked")
                Enumeration<Header> e = headers.getAllHeaders();
                while (e.hasMoreElements()) {
                    Header header = e.nextElement();
                    inBoundHeaders.putSingle(header.getName(),
                            header.getValue());
                }

                ClientResponse clientResponse = new ClientResponse(
                        status.getStatus(), inBoundHeaders, content, null);
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

            }
        }
    }

    private InBoundHeaders getInBoundHeaders(HttpURLConnection urlConnection) {
        InBoundHeaders headers = new InBoundHeaders();
        for (Map.Entry<String, List<String>> e : urlConnection
                .getHeaderFields().entrySet()) {
            if (e.getKey() != null) {
                headers.put(e.getKey(), e.getValue());
            }
        }
        return headers;
    }
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

            if (request.getURI().toString().startsWith(uriToRedirect)) {
                ClientResponse response = Mockito.mock(ClientResponse.class);
                Mockito.when(response.getClientResponseStatus()).thenReturn(
                        ClientResponse.Status.MOVED_PERMANENTLY);
                MultivaluedMap<String, String> headers = new InBoundHeaders();
                headers.add("location", uriRedirectedTo);
                Mockito.when(response.getHeaders()).thenReturn(headers);
                return response;
            } else {
                return getNext().handle(request);
            }
View Full Code Here

Examples of com.sun.jersey.core.header.InBoundHeaders

    return "http://" + request.getHeader(HttpHeaders.Names.HOST) + "/";
  }

  private InBoundHeaders getHeaders(HttpRequest request) {
    InBoundHeaders headers = new InBoundHeaders();
    for (String name : request.getHeaderNames()) {
      headers.put(name, request.getHeaders(name));
    }
    return headers;
  }
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.