Some more servlet cleanup
Change-Id: I9ba2895f1c3d52e30c90ab3cdbe9b6db17e56aa3
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1526
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
index c6c76dd..25ceaff 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
@@ -45,11 +45,7 @@
}
@Override
- public void handle(IServletRequest request, IServletResponse response) {
- if (request.getHttpRequest().method() != HttpMethod.GET) {
- response.setStatus(HttpResponseStatus.METHOD_NOT_ALLOWED);
- return;
- }
+ protected void get(IServletRequest request, IServletResponse response) {
String path = path(request);
while (path.startsWith("/")) {
path = path.substring(1);
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/StaticResourceServlet.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/StaticResourceServlet.java
index 046b124..4d564ba 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/StaticResourceServlet.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/StaticResourceServlet.java
@@ -42,22 +42,7 @@
}
@Override
- public void handle(IServletRequest request, IServletResponse response) {
- try {
- if (request.getHttpRequest().method() == HttpMethod.GET) {
- doGet(request, response);
- } else if (request.getHttpRequest().method() == HttpMethod.POST) {
- doPost(request, response);
- } else {
- response.setStatus(HttpResponseStatus.METHOD_NOT_ALLOWED);
- }
- } catch (IOException e) {
- LOGGER.log(Level.WARNING, "Failure setting content type", e);
- response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
- }
- }
-
- protected void doGet(IServletRequest request, IServletResponse response) throws IOException {
+ protected void get(IServletRequest request, IServletResponse response) throws IOException {
String resourcePath = request.getHttpRequest().uri();
deliverResource(resourcePath, response);
}
@@ -90,10 +75,6 @@
}
}
- protected void doPost(IServletRequest request, IServletResponse response) throws IOException {
- response.setStatus(HttpResponseStatus.METHOD_NOT_ALLOWED);
- }
-
public static String extension(String path) {
int i = path.lastIndexOf('.');
return i < 1 ? "" : path.substring(i);