Skip to content

Commit 046020f

Browse files
committed
status.json and favicon.svg
1 parent 88d0f4e commit 046020f

File tree

8 files changed

+366
-22
lines changed

8 files changed

+366
-22
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 4
10+
indent_style = tab
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.yaml]
15+
indent_size = 2
16+
indent_style = space
17+
18+
[*.json]
19+
indent_size = 2
20+
indent_style = space

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*~
2+
*.amp.html
3+
.cache
4+
*.class
5+
crash.log
6+
dist/
7+
.DS_Store
8+
*.env
9+
*.gz
10+
.idea/
11+
.jekyll-metadata
12+
node_modules/
13+
*.pyc
14+
.sass-cache/
15+
_site/
16+
tmp/
17+
_tmp/
18+
*.tgz
19+
venv/
20+
.vscode/
21+
*.zip
File renamed without changes.

deploy.sh

+15
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1+
#!/bin/bash
2+
#
3+
# deploy to AppEngine
4+
#
5+
6+
set -o errexit
7+
set -o pipefail
8+
set -o nounset
9+
10+
xmlstarlet edit --inplace --update "//_:property[@name='COMMIT']/@value" -v $(git rev-parse --short HEAD) www/WEB-INF/appengine-web.xml
11+
xmlstarlet edit --inplace --update "//_:property[@name='LASTMOD']/@value" -v $(date -u +%Y-%m-%dT%H:%M:%SZ) www/WEB-INF/appengine-web.xml
12+
113
/usr/local/appengine-java-sdk/bin/appcfg.sh --oauth2 update www/
14+
15+
xmlstarlet edit --inplace --update "//_:property[@name='COMMIT']/@value" -v dev www/WEB-INF/appengine-web.xml
16+
xmlstarlet edit --inplace --update "//_:property[@name='LASTMOD']/@value" -v dev www/WEB-INF/appengine-web.xml

www/WEB-INF/appengine-web.xml

+16-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1+
<?xml version="1.0"?>
12
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
2-
3-
<application>regexplanet-java</application>
4-
5-
<runtime>java8</runtime>
6-
7-
<sessions-enabled>false</sessions-enabled>
8-
9-
<!--
3+
<application>regexplanet-java</application>
4+
<runtime>java8</runtime>
5+
<sessions-enabled>false</sessions-enabled>
6+
<!--
107
<static-error-handlers>
118
<handler file="/_err/over_quota.txt" error-code="over_quota"/>
129
<handler file="/_err/dos_denial.txt" error-code="dos_api_denial" />
1310
<handler file="/_err/timeout.txt" error-code="timeout" />
1411
</static-error-handlers>
1512
-->
16-
17-
<static-files>
18-
<include path="/favicon.ico" expiration="7d" />
19-
</static-files>
20-
21-
<system-properties>
22-
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
23-
</system-properties>
24-
25-
<threadsafe>true</threadsafe>
26-
27-
<version>4</version>
28-
13+
<static-files>
14+
<include path="/favicon.ico" expiration="7d"/>
15+
<include path="/favicon.svg" expiration="7d"/>
16+
</static-files>
17+
<system-properties>
18+
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
19+
<property name="COMMIT" value="dev"/>
20+
<property name="LASTMOD" value="dev"/>
21+
</system-properties>
22+
<threadsafe>true</threadsafe>
23+
<version>4</version>
2924
</appengine-web-app>

www/WEB-INF/web.xml

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
<location>/_err/500.jsp</location>
1818
</error-page>
1919

20+
<servlet>
21+
<servlet-name>StatusJson</servlet-name>
22+
<jsp-file>/status.jsp</jsp-file>
23+
</servlet>
24+
25+
<servlet-mapping>
26+
<servlet-name>StatusJson</servlet-name>
27+
<url-pattern>/status.json</url-pattern>
28+
</servlet-mapping>
29+
2030
<system-properties>
2131
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
2232
</system-properties>

www/favicon.svg

+271
Loading

www/status.jsp

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<%@ page contentType="text/plain;charset=utf-8"
2-
import="org.json.simple.*"
2+
import="java.io.*,
3+
java.time.*,
4+
java.time.format.*,
5+
java.util.*,
6+
java.util.regex.*,
7+
org.json.simple.*"
38
%><%
49
510
JSONObject retVal = new JSONObject();
611
712
retVal.put("success", Boolean.TRUE);
813
retVal.put("message", "OK");
14+
retVal.put("commit", System.getProperty("COMMIT"));
15+
retVal.put("timestamp", ZonedDateTime.now( ZoneOffset.UTC ).format( DateTimeFormatter.ISO_INSTANT ));
16+
retVal.put("lastmod", System.getProperty("LASTMOD"));
17+
retVal.put("tech", "Java " + System.getProperty("java.specification.version", "(unknown)"));
918
retVal.put("version", System.getProperty("java.version", "Unknown") + " (" + System.getProperty("java.vm.name", "Unknown VM") + ")");
1019
retVal.put("java.vendor", System.getProperty("java.vendor"));
1120
retVal.put("java.version", System.getProperty("java.version"));
@@ -32,6 +41,9 @@
3241
}
3342
else
3443
{
44+
response.setHeader("Access-Control-Allow-Origin", "*");
45+
response.setHeader("Access-Control-Allow-Methods", "GET, POST");
46+
response.setHeader("Access-Control-Max-Age", "604800");
3547
out.print(json);
3648
}
3749
%>

0 commit comments

Comments
 (0)