MCPcopy
hub / github.com/dunwu/nginx-tutorial / main

Method main

examples/javaapp/src/main/java/io/github/dunwu/Main.java:26–62  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

24 private static final String CONTEXT_PATH = "/";
25
26 public static void main(String[] args) throws Exception {
27 System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "{}|");
28
29 System.setProperty("tomcat.host.appBase", getAbsolutePath());
30 File checkFile = new File(System.getProperty("tomcat.host.appBase") + "/WEB-INF");
31 if (!checkFile.exists()) {
32 System.setProperty("catalina.base", getAbsolutePath() + RELATIVE_DEV_BASE_DIR);
33 System.setProperty("tomcat.context.docBase", RELATIVE_DEV_DOCBASE_DIR);
34 } else {
35 System.setProperty("catalina.base", getAbsolutePath() + RELATIVE_BASE_DIR);
36 System.setProperty("tomcat.context.docBase", RELATIVE_DOCBASE_DIR);
37 }
38
39 if (isBlank(System.getProperty("tomcat.connector.port"))) {
40 System.setProperty("tomcat.connector.port", CONNECTOR_PORT);
41 }
42 if (isBlank(System.getProperty("tomcat.server.shutdownPort"))) {
43 System.setProperty("tomcat.server.shutdownPort",
44 String.valueOf(Integer.valueOf(System.getProperty("tomcat.connector.port")) + 10000));
45 }
46 if (isBlank(System.getProperty("tomcat.context.path"))) {
47 System.setProperty("tomcat.context.path", CONTEXT_PATH);
48 }
49
50 System.out.println("====================ENV setting====================");
51 System.out.println("spring.profiles.active:" + System.getProperty("spring.profiles.active"));
52 System.out.println("catalina.base:" + System.getProperty("catalina.base"));
53 System.out.println("tomcat.host.appBase:" + System.getProperty("tomcat.host.appBase"));
54 System.out.println("tomcat.context.docBase:" + System.getProperty("tomcat.context.docBase"));
55 System.out.println("tomcat.context.path:" + System.getProperty("tomcat.context.path"));
56 System.out.println("tomcat.connector.port:" + System.getProperty("tomcat.connector.port"));
57 System.out.println("tomcat.server.shutdownPort:" + System.getProperty("tomcat.server.shutdownPort"));
58
59 ExtendedTomcat tomcat = new ExtendedTomcat();
60 tomcat.start();
61 tomcat.getServer().await();
62 }
63
64 private static String getAbsolutePath() {
65 String path = null;

Callers

nothing calls this directly

Calls 3

getAbsolutePathMethod · 0.95
isBlankMethod · 0.95
getServerMethod · 0.95

Tested by

no test coverage detected