private void checkTypeOfResponse() { responseBuilder = new ResponseFactory(request, root); if (ResponseCode != 400) { try { File temp = new File(root + request.GetRequestPath()); System.out.println(request.GetMessageBody()); System.out.println(request.GetRequestPath()); if (temp.isFile() || request.GetRequestPath().equals(PARAMS_PAGE)) { switch (request.GetRequestType()) { case GET: responseBuilder = new GETResponse(request, root); ResponseCode = 200; ResponseReason = "OK"; break; case POST: responseBuilder = new GETResponse(request, root); ResponseCode = 200; ResponseReason = "OK"; break; case TRACE: responseBuilder = new TRACEResponse(request, root); ResponseCode = 200; ResponseReason = "OK"; break; case HEAD: responseBuilder = new HEADRespones(request, root); ResponseCode = 200; ResponseReason = "OK"; break; default: ResponseCode = 501; ResponseReason = "Unimplemented Method"; break; } } else { ResponseCode = 404; ResponseReason = "File Not Found"; } } catch (Exception e) { ResponseCode = 500; ResponseReason = "Internal Server Error"; } } }
private boolean isCrawlingRequest() { return (request.GetRequestType() == eRequestType.POST && request.GetRequestPath().contains("execResults.html")); }