Package org.springframework.security.web

Examples of org.springframework.security.web.PortMapperImpl


     *
     * @return the {@link PortMapper} to use
     */
    private PortMapper getPortMapper() {
        if(portMapper == null) {
            PortMapperImpl portMapper = new PortMapperImpl();
            portMapper.setPortMappings(httpsPortMappings);
            this.portMapper = portMapper;
        }
        return portMapper;
    }
View Full Code Here


        request.setServerPort(443);

        MockHttpServletResponse response = new MockHttpServletResponse();

        RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
        ep.setPortMapper(new PortMapperImpl());
        ep.setPortResolver(new MockPortResolver(80, 443));

        ep.commence(request, response);
        assertEquals("http://www.example.com/bigWebApp/hello/pathInfo.html?open=true", response.getRedirectedUrl());
    }
View Full Code Here

        request.setServerPort(443);

        MockHttpServletResponse response = new MockHttpServletResponse();

        RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
        ep.setPortMapper(new PortMapperImpl());
        ep.setPortResolver(new MockPortResolver(80, 443));

        ep.commence(request, response);
        assertEquals("http://www.example.com/bigWebApp/hello", response.getRedirectedUrl());
    }
View Full Code Here

        request.setServerPort(8768);

        MockHttpServletResponse response = new MockHttpServletResponse();

        RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
        ep.setPortMapper(new PortMapperImpl());
        ep.setPortResolver(new MockPortResolver(8768, 1234));

        ep.commence(request, response);
        assertEquals("/bigWebApp?open=true", response.getRedirectedUrl());
    }
View Full Code Here

        request.setServerName("www.example.com");
        request.setServerPort(9999);

        MockHttpServletResponse response = new MockHttpServletResponse();

        PortMapperImpl portMapper = new PortMapperImpl();
        Map<String, String> map = new HashMap<String, String>();
        map.put("8888", "9999");
        portMapper.setPortMappings(map);

        RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
        ep.setPortResolver(new MockPortResolver(8888, 9999));
        ep.setPortMapper(portMapper);
View Full Code Here

    }

    public void testGettersSetters() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();
        assertTrue(pr.getPortMapper() != null);
        pr.setPortMapper(new PortMapperImpl());
        assertTrue(pr.getPortMapper() != null);
    }
View Full Code Here

*/
public class PortMapperImplTests extends TestCase {
    //~ Methods ========================================================================================================

    public void testDefaultMappingsAreKnown() throws Exception {
        PortMapperImpl portMapper = new PortMapperImpl();
        assertEquals(Integer.valueOf(80), portMapper.lookupHttpPort(Integer.valueOf(443)));
        assertEquals(Integer.valueOf(8080), portMapper.lookupHttpPort(Integer.valueOf(8443)));
        assertEquals(Integer.valueOf(443), portMapper.lookupHttpsPort(Integer.valueOf(80)));
        assertEquals(Integer.valueOf(8443), portMapper.lookupHttpsPort(Integer.valueOf(8080)));
    }
View Full Code Here

        assertEquals(Integer.valueOf(443), portMapper.lookupHttpsPort(Integer.valueOf(80)));
        assertEquals(Integer.valueOf(8443), portMapper.lookupHttpsPort(Integer.valueOf(8080)));
    }

    public void testDetectsEmptyMap() throws Exception {
        PortMapperImpl portMapper = new PortMapperImpl();

        try {
            portMapper.setPortMappings(new HashMap<String,String>());
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

            assertTrue(true);
        }
    }

    public void testDetectsNullMap() throws Exception {
        PortMapperImpl portMapper = new PortMapperImpl();

        try {
            portMapper.setPortMappings(null);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

            assertTrue(true);
        }
    }

    public void testGetTranslatedPortMappings() {
        PortMapperImpl portMapper = new PortMapperImpl();
        assertEquals(2, portMapper.getTranslatedPortMappings().size());
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.PortMapperImpl

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.