Package org.springframework.security.web.header.writers

Examples of org.springframework.security.web.header.writers.StaticHeadersWriter


        response = new MockHttpServletResponse();
    }

    @Test(expected = IllegalArgumentException.class)
    public void constructorNullHeaders() {
        new StaticHeadersWriter(null);
    }
View Full Code Here


        new StaticHeadersWriter(null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void constructorEmptyHeaders() {
        new StaticHeadersWriter(Collections.<Header>emptyList());
    }
View Full Code Here

        new StaticHeadersWriter(Collections.<Header>emptyList());
    }

    @Test(expected = IllegalArgumentException.class)
    public void constructorNullHeaderName() {
        new StaticHeadersWriter(null, "value1");
    }
View Full Code Here

        new StaticHeadersWriter(null, "value1");
    }

    @Test(expected = IllegalArgumentException.class)
    public void constructorNullHeaderValues() {
        new StaticHeadersWriter("name", (String[]) null);
    }
View Full Code Here

        new StaticHeadersWriter("name", (String[]) null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void constructorContainsNullHeaderValue() {
        new StaticHeadersWriter("name", "value1", null);
    }
View Full Code Here

    @Test
    public void sameHeaderShouldBeReturned() {
        String headerName = "X-header";
        String headerValue = "foo";
        StaticHeadersWriter factory = new StaticHeadersWriter(headerName, headerValue);

        factory.writeHeaders(request, response);
        assertThat(response.getHeaderValues(headerName)).isEqualTo(Arrays.asList(headerValue));
    }
View Full Code Here

    @Test
    public void writeHeadersMulti() {
        Header pragma = new Header("Pragma","no-cache");
        Header cacheControl= new Header("Cache-Control","no-cache","no-store","must-revalidate");
        StaticHeadersWriter factory = new StaticHeadersWriter(Arrays.asList(pragma, cacheControl));

        factory.writeHeaders(request, response);

        assertThat(response.getHeaderNames().size()).isEqualTo(2);
        assertThat(response.getHeaderValues(pragma.getName())).isEqualTo(pragma.getValues());
        assertThat(response.getHeaderValues(cacheControl.getName())).isEqualTo(cacheControl.getValues());
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.header.writers.StaticHeadersWriter

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.