Skip to content

Commit d903ec4

Browse files
committed
ChartApplication: disable unnecessary configs
1 parent 6c6db0b commit d903ec4

File tree

4 files changed

+35
-36
lines changed

4 files changed

+35
-36
lines changed

click-charts-examples/src/main/java/net/sf/click/examples/page/BorderPage.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
import org.apache.click.extras.control.MenuFactory;
77
import org.apache.click.util.ClickUtils;
88

9+
import java.io.Serial;
910
import java.util.concurrent.ThreadLocalRandom;
1011

1112
public class BorderPage extends Page {
12-
private static final long serialVersionUID = 3721746656550335085L;
13+
@Serial private static final long serialVersionUID = 3721746656550335085L;
1314

1415
private final Menu rootMenu = new MenuFactory().getRootMenu();
1516

1617
protected JSChart getChart(){
1718
return null;// HomePage, etc
1819
}
1920

20-
21-
public BorderPage() {
21+
public BorderPage () {
2222
String className = getClass().getName();
2323

2424
String shortName = className.substring(className.lastIndexOf('.') + 1);
@@ -29,13 +29,14 @@ public BorderPage() {
2929
addModel("srcPath", srcPath);
3030

3131
addControl(rootMenu);
32-
}
32+
}//new
3333

3434
/** @see #getTemplate() */
3535
@Override public String getTemplate (){ return "border-template.htm"; }
3636

3737
/** @see org.apache.click.Page#onInit() */
38-
@Override public void onInit() {
38+
@Override
39+
public void onInit() {
3940
super.onInit();
4041

4142
var chart = getChart();

click-charts-examples/src/main/java/net/sf/click/examples/page/ChartApplication.java

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,34 @@
66
import org.springframework.boot.autoconfigure.SpringBootApplication;
77
import org.springframework.boot.web.servlet.ServletRegistrationBean;
88
import org.springframework.context.annotation.Bean;
9-
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
10-
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
11-
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
12-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
139

1410
import java.util.HashMap;
1511

1612
@SpringBootApplication // (scanBasePackageClasses = { LunaApplication.class, RemoteMvelConsoleController.class })
17-
@EnableWebMvc
18-
public class ChartApplication implements WebMvcConfigurer {
19-
13+
// @EnableWebMvc implements WebMvcConfigurer
14+
public class ChartApplication {
2015
public static void main (String[] args) {
2116
System.out.println(" *** main thread started *** "+Thread.currentThread());
2217
SpringApplication.run(ChartApplication.class, args);
2318
System.err.println(" *** main thread finishes *** "+Thread.currentThread());
2419
}
2520

26-
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
27-
"classpath:/META-INF/resources/",// todo classpath*:
28-
"classpath:/META-INF/resources/click/",
29-
"classpath:/resources/",
30-
"classpath:/resources/click/",
31-
"classpath:/static/",
32-
"classpath:/static/click/",
33-
"classpath:/public/"
34-
};
35-
36-
@Override
37-
public void addResourceHandlers(ResourceHandlerRegistry registry) {
38-
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
39-
}
21+
// private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
22+
// "classpath:/META-INF/resources/",// todo classpath*:
23+
// "classpath:/resources/",
24+
// "classpath:/static/",
25+
// "classpath:/public/"
26+
// };
27+
// @Override public void addResourceHandlers(ResourceHandlerRegistry registry) {
28+
// registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
29+
// }
30+
//@Override public void addViewControllers(ViewControllerRegistry registry) {
31+
// registry.addViewController("/").setViewName("forward:/home.htm");
32+
//}
4033

4134
@Bean
4235
public ServletRegistrationBean<ClickServlet> clickServlet () {
43-
val reg = new ServletRegistrationBean<>(new ClickServlet(), "*.htm", "/click/*");
36+
val reg = new ServletRegistrationBean<>(new ClickServlet(), "*.htm");// , "/click/*"
4437
reg.setName("ClickServlet");
4538
reg.setLoadOnStartup(0);
4639

@@ -53,10 +46,4 @@ public ServletRegistrationBean<ClickServlet> clickServlet () {
5346

5447
return reg;
5548
}
56-
57-
@Override
58-
public void addViewControllers(ViewControllerRegistry registry) {
59-
registry.addViewController("/").setViewName("forward:/home.htm");
60-
}
61-
6249
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package net.sf.click.examples.page;
22

3-
4-
3+
/** click-charts-examples/src/main/resources/META-INF/resources/home.htm */
54
public class HomePage extends BorderPage {
6-
private static final long serialVersionUID = 8033866056407918271L;
75
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html><head>
3+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
4+
<meta http-equiv="Refresh" content="0;URL=/home.htm">
5+
</head>
6+
<body>
7+
Redirecting...
8+
<script>
9+
setTimeout(function() {
10+
window.location.href = '/home';
11+
}, 1000);
12+
</script>
13+
</body></html>

0 commit comments

Comments
 (0)