Skip to content

Commit 6481a3a

Browse files
committed
Added CORS headers
1 parent fe04454 commit 6481a3a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

www/test.jsp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
org.apache.commons.lang3.math.*"
99
%><%
1010
11+
response.setHeader("Access-Control-Allow-Origin", "*"); //"http://www.regexplanet.com");
12+
response.setHeader("Access-Control-Allow-Methods", "POST, GET");
13+
response.setHeader("Access-Control-Max-Age", Integer.toString(60 * 60 * 24 * 7));
14+
if (request.getMethod().equalsIgnoreCase("options"))
15+
{
16+
out.print("yes, CORS is allowed!");
17+
return;
18+
}
19+
1120
Locale loc = request.getLocale();
1221
1322
JSONObject retVal = new JSONObject();

0 commit comments

Comments
 (0)