Package org.glassfish.jersey.internal

Examples of org.glassfish.jersey.internal.MapPropertiesDelegate


        this(baseUri == null || baseUri.isEmpty() ? null : URI.create(baseUri), URI.create(requestUri), method);
    }

    private RequestContextBuilder(URI baseUri, URI requestUri, String method) {
        result = new TestContainerRequest(baseUri, requestUri, method, null,
                new MapPropertiesDelegate());
    }
View Full Code Here


    @Test
    public void testAcceptableMediaTypes() throws URISyntaxException {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.ACCEPT, "application/xml, text/plain");
        r.header(HttpHeaders.ACCEPT, "application/json");
        assertEquals(r.getAcceptableMediaTypes().size(), 3);
        assertTrue(r.getAcceptableMediaTypes().contains(MediaType.APPLICATION_XML_TYPE));
        assertTrue(r.getAcceptableMediaTypes().contains(MediaType.TEXT_PLAIN_TYPE));
View Full Code Here

    @Test
    public void testAcceptableLanguages() throws URISyntaxException {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.ACCEPT_LANGUAGE, "en-gb;q=0.8, en;q=0.7");
        r.header(HttpHeaders.ACCEPT_LANGUAGE, "de");
        assertEquals(r.getAcceptableLanguages().size(), 3);
        assertTrue(r.getAcceptableLanguages().contains(Locale.UK));
        assertTrue(r.getAcceptableLanguages().contains(Locale.ENGLISH));
View Full Code Here

    @Test
    public void testMethod() {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        assertEquals(r.getMethod(), "GET");
    }
View Full Code Here

    @Test
    public void testUri() throws URISyntaxException {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        assertEquals(r.getRequestUri(), URI.create("http://example.org/app/resource"));
    }
View Full Code Here

    @Test
    public void testSelectVariant() {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
        r.header(HttpHeaders.ACCEPT_LANGUAGE, "en");
        List<Variant> lv = Variant
                .mediaTypes(MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_JSON_TYPE)
                .languages(Locale.ENGLISH, Locale.FRENCH)
View Full Code Here

    @Test
    public void testPreconditionsMatch() {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.IF_MATCH, "\"686897696a7c876b7e\"");
        assertNull(r.evaluatePreconditions(new EntityTag("686897696a7c876b7e")));
        assertEquals(r.evaluatePreconditions(new EntityTag("0")).build().getStatus(),
                Response.Status.PRECONDITION_FAILED.getStatusCode());
    }
View Full Code Here

    @Test
    public void testPreconditionsNoneMatch() {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.IF_NONE_MATCH, "\"686897696a7c876b7e\"");
        assertEquals(r.evaluatePreconditions(new EntityTag("686897696a7c876b7e")).build().getStatus(),
                Response.Status.NOT_MODIFIED.getStatusCode());
        assertNull(r.evaluatePreconditions(new EntityTag("000000000000000000")));
    }
View Full Code Here

    @Test
    public void testPreconditionsModified() throws ParseException {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.IF_MODIFIED_SINCE, "Sat, 29 Oct 2011 19:43:31 GMT");
        SimpleDateFormat f = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
        Date date = f.parse("Sat, 29 Oct 2011 19:43:31 GMT");
        assertEquals(r.evaluatePreconditions(date).build().getStatus(),
                Response.Status.NOT_MODIFIED.getStatusCode());
View Full Code Here

    @Test
    public void testPreconditionsUnModified() throws ParseException {
        ContainerRequest r = new ContainerRequest(
                URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"),
                "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
        r.header(HttpHeaders.IF_UNMODIFIED_SINCE, "Sat, 29 Oct 2011 19:43:31 GMT");
        SimpleDateFormat f = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
        Date date = f.parse("Sat, 29 Oct 2011 19:43:31 GMT");
        assertNull(r.evaluatePreconditions(date));
        date = f.parse("Sat, 30 Oct 2011 19:43:31 GMT");
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.internal.MapPropertiesDelegate

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.