Skip to content

Commit 2c9fa6a

Browse files
author
eugenp
committed
formatting cleanup
1 parent 2499509 commit 2c9fa6a

4 files changed

Lines changed: 22 additions & 29 deletions

File tree

‎handling-spring-static-resources/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class MySimpleUrlAuthenticationSuccessHandler implements AuthenticationSu
1818
private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
1919

2020
@Override
21-
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
21+
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
2222
handle(request, response, authentication);
2323
HttpSession session = request.getSession(false);
2424
if (session != null) {
@@ -39,9 +39,9 @@ protected void handle(HttpServletRequest request, HttpServletResponse response,
3939
}
4040

4141
protected String determineTargetUrl(Authentication authentication) {
42-
43-
return "/home.html";
44-
42+
43+
return "/home.html";
44+
4545
}
4646

4747
protected void clearAuthenticationAttributes(HttpServletRequest request) {

‎handling-spring-static-resources/src/main/java/org/baeldung/spring/MvcConfig.java‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.baeldung.spring;
22

3-
43
import java.util.Locale;
54

6-
75
import org.springframework.beans.factory.annotation.Autowired;
86
import org.springframework.context.MessageSource;
97
import org.springframework.context.annotation.Bean;
@@ -42,9 +40,9 @@ public MvcConfig() {
4240
@Override
4341
public void addViewControllers(final ViewControllerRegistry registry) {
4442
super.addViewControllers(registry);
45-
registry.addViewController("/login.html");
43+
registry.addViewController("/login.html");
4644
registry.addViewController("/home.html");
47-
45+
4846
}
4947

5048
@Bean
@@ -55,23 +53,21 @@ public ViewResolver viewResolver() {
5553
bean.setSuffix(".jsp");
5654
return bean;
5755
}
58-
56+
5957
@Override
60-
public void addResourceHandlers(ResourceHandlerRegistry registry) {
61-
//For examples using Spring 4.1.0
62-
if((env.getProperty("resource.handler.conf")).equals("4.1.0")){
58+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
59+
// For examples using Spring 4.1.0
60+
if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) {
6361
registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver()).addResolver(new PathResourceResolver());
6462
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
6563
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
66-
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").
67-
setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver());
68-
}
69-
//For examples using Spring 4.0.7
70-
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")){
64+
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver());
65+
}
66+
// For examples using Spring 4.0.7
67+
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) {
7168
registry.addResourceHandler("/resources/**").addResourceLocations("/", "/resources/", "classpath:/other-resources/");
72-
registry.addResourceHandler("/files/**")
73-
.addResourceLocations("file:/Users/Elena/");
74-
69+
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/");
70+
7571
}
7672
}
7773

‎handling-spring-static-resources/src/main/java/org/baeldung/spring/SecSecurityConfig.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@ImportResource({ "classpath:webSecurityConfig.xml" })
88
public class SecSecurityConfig {
99

10-
public SecSecurityConfig() {
10+
public SecSecurityConfig() {
1111
super();
1212
}
1313

‎handling-spring-static-resources/src/main/java/org/baeldung/web/controller/HomeController.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@
1414

1515
@Controller
1616
public class HomeController {
17-
18-
19-
17+
2018
@Autowired
2119
Environment env;
22-
2320

2421
@RequestMapping(value = "/home", method = RequestMethod.GET)
2522
public String showHome(WebRequest request, Model model, Locale locale) throws IOException {
26-
23+
2724
Date date = new Date();
2825
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
29-
26+
3027
String formattedDate = dateFormat.format(date);
31-
model.addAttribute("serverTime", formattedDate );
28+
model.addAttribute("serverTime", formattedDate);
3229
return "home";
3330
}
34-
31+
3532
}

0 commit comments

Comments
 (0)