formatting cleanup
This commit is contained in:
parent
2499509ada
commit
2c9fa6a010
@ -18,7 +18,7 @@ public class MySimpleUrlAuthenticationSuccessHandler implements AuthenticationSu
|
||||
private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
|
||||
handle(request, response, authentication);
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session != null) {
|
||||
@ -39,9 +39,9 @@ public class MySimpleUrlAuthenticationSuccessHandler implements AuthenticationSu
|
||||
}
|
||||
|
||||
protected String determineTargetUrl(Authentication authentication) {
|
||||
|
||||
return "/home.html";
|
||||
|
||||
|
||||
return "/home.html";
|
||||
|
||||
}
|
||||
|
||||
protected void clearAuthenticationAttributes(HttpServletRequest request) {
|
||||
|
@ -1,9 +1,7 @@
|
||||
package org.baeldung.spring;
|
||||
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -42,9 +40,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
|
||||
@Override
|
||||
public void addViewControllers(final ViewControllerRegistry registry) {
|
||||
super.addViewControllers(registry);
|
||||
registry.addViewController("/login.html");
|
||||
registry.addViewController("/login.html");
|
||||
registry.addViewController("/home.html");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ -55,23 +53,21 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
|
||||
bean.setSuffix(".jsp");
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//For examples using Spring 4.1.0
|
||||
if((env.getProperty("resource.handler.conf")).equals("4.1.0")){
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// For examples using Spring 4.1.0
|
||||
if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) {
|
||||
registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver()).addResolver(new PathResourceResolver());
|
||||
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
||||
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
||||
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").
|
||||
setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver());
|
||||
}
|
||||
//For examples using Spring 4.0.7
|
||||
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")){
|
||||
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver());
|
||||
}
|
||||
// For examples using Spring 4.0.7
|
||||
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) {
|
||||
registry.addResourceHandler("/resources/**").addResourceLocations("/", "/resources/", "classpath:/other-resources/");
|
||||
registry.addResourceHandler("/files/**")
|
||||
.addResourceLocations("file:/Users/Elena/");
|
||||
|
||||
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.springframework.context.annotation.ImportResource;
|
||||
@ImportResource({ "classpath:webSecurityConfig.xml" })
|
||||
public class SecSecurityConfig {
|
||||
|
||||
public SecSecurityConfig() {
|
||||
public SecSecurityConfig() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -14,22 +14,19 @@ import org.springframework.web.context.request.WebRequest;
|
||||
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
Environment env;
|
||||
|
||||
|
||||
@RequestMapping(value = "/home", method = RequestMethod.GET)
|
||||
public String showHome(WebRequest request, Model model, Locale locale) throws IOException {
|
||||
|
||||
|
||||
Date date = new Date();
|
||||
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
|
||||
|
||||
|
||||
String formattedDate = dateFormat.format(date);
|
||||
model.addAttribute("serverTime", formattedDate );
|
||||
model.addAttribute("serverTime", formattedDate);
|
||||
return "home";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user