-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Request.Method method;
try {
method = Request.Method.valueOf(req.getMethod().toUpperCase());
} catch (IllegalArgumentException e) {
super.service(req, resp);
return;
}
do {
if (!method.equals(Request.Method.GET)) {
break;
}
String root = (String) this.getServletContext().getAttribute("resource.root");
if (root == null) {
break;
}
String path = root + req.getPathInfo();
this.logger.debug("Trying to read \"{}\".", path);
InputStream in = null;
try {
in = new FileInputStream(path); <=== REST GET also runs this.
} catch (FileNotFoundException e) {
break;
}
OutputStream out = resp.getOutputStream();
IOUtils.copy(in, out);
try {
in.close();
} catch (IOException e) {
// just ignore.
}
return;
} while (false);
doRequestToComponent(req, resp, method);
}