protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- if (request.getPathInfo().startsWith("/ITMILL/")) {
+ if (request.getPathInfo() != null
+ && request.getPathInfo().startsWith("/ITMILL/")) {
serveStaticResourcesInITMILL(request, response);
return;
}
-
+
Application application = null;
try {
}
}
- /** Serve resources in ITMILL directory if requested.
+ /**
+ * Serve resources in ITMILL directory if requested.
*
* @param request
* @param response
* @throws IOException
*/
- private void serveStaticResourcesInITMILL(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ private void serveStaticResourcesInITMILL(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
String filename = request.getPathInfo();
ServletContext sc = getServletContext();
InputStream is = sc.getResourceAsStream(filename);
return;
}
String mimetype = sc.getMimeType(filename);
- if (mimetype != null) response.setContentType(mimetype);
+ if (mimetype != null)
+ response.setContentType(mimetype);
OutputStream os = response.getOutputStream();
byte buffer[] = new byte[20000];
int bytes;
BufferedWriter page = new BufferedWriter(new OutputStreamWriter(
response.getOutputStream()));
- String uri = request.getRequestURL().toString();
- boolean hasSlash = (uri.charAt(uri.length() - 1) == '/') ? true : false;
-
String relative = "";
- String t = request.getPathInfo().substring(1);
+
+ String pathInfo = request.getPathInfo() == null ? "/" : request.getPathInfo();
+ String t = pathInfo.substring(1);
while (t.indexOf('/') >= 0) {
t = t.substring(t.indexOf('/') + 1);
relative += "../";
page
.write("', pathInfo: '"
- + request.getPathInfo()
+ + pathInfo
+ "'\n};\n"
+ "</script>\n"
+ "<script language='javascript' src='"
- + appUrl + "/"
+ + appUrl
+ + "/"
+ WIDGETSET_DIRECTORY_PATH
+ widgetset
+ "/"