Examples of InBoundHeaders


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

  @Test
  public void testCanonicalRepresentation_Server_AllFields_Get() throws Exception {

    // Mock headers
    InBoundHeaders headers = new InBoundHeaders();
    headers.add(HttpHeaders.DATE, "Sat, 01 Jan 2000 12:34:56 GMT");
    headers.add(HttpHeaders.HOST, "www.example.org");
    headers.add(HttpHeaders.USER_AGENT, "curl/7.20.0 (x86_64-pc-linux-gnu) libcurl/7.20.0 OpenSSL/1.0.0a zlib/1.2.3");
    headers.add(HmacUtils.X_HMAC_DATE, "Sat, 01 Jan 2000 12:34:57 GMT");
    headers.add(HmacUtils.X_HMAC_NONCE, "Thohn2Mohd2zugo");

    // Mock request
    ContainerRequest containerRequest = mock(ContainerRequest.class);
    when(containerRequest.getRequestHeaders()).thenReturn(headers);
    when(containerRequest.getMethod()).thenReturn("GET");
View Full Code Here

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

  @Test
  public void testCanonicalRepresentation_Server_AllFields_Post() throws Exception {

    // Mock headers
    InBoundHeaders headers = new InBoundHeaders();
    headers.add(HttpHeaders.DATE, "Sat, 01 Jan 2000 12:34:56 GMT");
    headers.add(HttpHeaders.HOST, "www.example.org");
    headers.add(HttpHeaders.USER_AGENT, "curl/7.20.0 (x86_64-pc-linux-gnu) libcurl/7.20.0 OpenSSL/1.0.0a zlib/1.2.3");
    headers.add(HmacUtils.X_HMAC_DATE, "Sat, 01 Jan 2000 12:34:57 GMT");
    headers.add(HmacUtils.X_HMAC_NONCE, "Thohn2Mohd2zugo");

    // Mock request
    ContainerRequest containerRequest = mock(ContainerRequest.class);
    when(containerRequest.getRequestHeaders()).thenReturn(headers);
    when(containerRequest.getMethod()).thenReturn("POST");
View Full Code Here

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

        }

        EndpointURI endpointUri = event.getEndpoint().getEndpointURI();
        String host = message.getInboundProperty("Host", endpointUri.getHost());
        String method = message.getInboundProperty(HttpConnector.HTTP_METHOD_PROPERTY);
        InBoundHeaders headers = new InBoundHeaders();
        for (Object prop : message.getInboundPropertyNames())
        {
            Object property = message.getInboundProperty(prop.toString());
            if (property != null)
            {
                headers.add(prop.toString(), property.toString());
            }
        }

        String scheme;
        if ("servlet".equals(endpointUri.getScheme()))
View Full Code Here

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

    @Test
    public void testGetMatchedURIs_0args() {
        WebApplicationContext instance = new WebApplicationContext(wa,
                new ContainerRequest(wa, "GET", UriBuilder.fromPath("http://localhost/").build(),
                    UriBuilder.fromPath("http://localhost/one%20two/three%20four").build(), new InBoundHeaders(), null)
                , null);
        instance.pushRightHandPathLength(12);
        assertEquals(instance.getMatchedURIs(true).get(0), instance.getMatchedURIs().get(0));
        assertNotSame(instance.getMatchedURIs(false).get(0), instance.getMatchedURIs().get(0));
    }
View Full Code Here

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

    @Test
    public void testGetMatchedURIs_boolean() {
        WebApplicationContext instance = new WebApplicationContext(wa,
                new ContainerRequest(wa, "GET", UriBuilder.fromPath("http://localhost/").build(),
                    UriBuilder.fromPath("http://localhost/one%20two/three%20four").build(), new InBoundHeaders(), null)
                , null);
        instance.pushRightHandPathLength(12);
        assertEquals("one%20two/", instance.getMatchedURIs(false).get(0));
        assertEquals("one two/", instance.getMatchedURIs(true).get(0));
    }
View Full Code Here

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

*/
public class ContainerRequestTest {

    @Test(expected = IllegalArgumentException.class)
    public void testEvaluatePreconditionsDate() throws Exception {
        ContainerRequest cr = new ContainerRequest(new WebApplicationImpl(), "GET", new URI("base/uri"), new URI("request/uri"), new InBoundHeaders(), null);

        cr.evaluatePreconditions((Date) null);
    }
View Full Code Here

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

        cr.evaluatePreconditions((Date) null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testEvaluatePreconditionsEntityTag() throws Exception {
        ContainerRequest cr = new ContainerRequest(new WebApplicationImpl(), "GET", new URI("base/uri"), new URI("request/uri"), new InBoundHeaders(), null);

        cr.evaluatePreconditions((EntityTag) null);
    }
View Full Code Here

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

        cr.evaluatePreconditions((EntityTag) null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testEvaluatePreconditionsBoth() throws Exception {
        ContainerRequest cr = new ContainerRequest(new WebApplicationImpl(), "GET", new URI("base/uri"), new URI("request/uri"), new InBoundHeaders(), null);

        cr.evaluatePreconditions(null, null);
    }
View Full Code Here

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

        ContainerRequest request = new ContainerRequest(
            app, // web application requested
            "GET", // HTTP method
            new URI("/"), // base URI
            new URI("/test"), // request URI
            new InBoundHeaders(), // headers
            IOUtils.toInputStream("") // incoming entity
        );
        ContainerResponse response = new ContainerResponse(
            app, // web application requested
            request, // container request
View Full Code Here

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

            }
        }
    }

    private InBoundHeaders getInBoundHeaders(HttpURLConnection uc) {
        InBoundHeaders headers = new InBoundHeaders();
        for (Map.Entry<String, List<String>> e : uc.getHeaderFields().entrySet()) {
            if (e.getKey() != null)
                headers.put(e.getKey(), e.getValue());
        }
        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.