List of usage examples for org.springframework.security.web DefaultRedirectStrategy setContextRelative
public void setContextRelative(boolean useRelativeContext)
From source file:org.terasoluna.gfw.security.web.redirect.RedirectAuthenticationHandlerTest.java
@Test public void testOnAuthenticationSuccess_SetNullRedirectToRedirectStrategyAndSetContextRelative() throws Exception { RedirectAuthenticationHandler redireHandler = new RedirectAuthenticationHandler(); DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); redirectStrategy.setContextRelative(true); redireHandler.setRedirectStrategy(redirectStrategy); // set Blank URI String redirectURI = "http://localhost/foo/bar"; request.setParameter("redirectTo", redirectURI); // expected data String expectedRedirectURL = "bar"; // run//w ww . ja va 2 s .c om redireHandler.onAuthenticationSuccess(request, response, auth); // assert assertThat(response.getRedirectedUrl(), is(expectedRedirectURL)); }