HttpServletResponse response) throws ServletException, IOException {
RequestContextUtil.createRequestContext(getServletContext(), request, response);
String pathInfo = request.getPathInfo();
LOG.debug("request path info: " + pathInfo);
RequestWorker worker = null;
if (pathInfo == null || pathInfo.equals("/")) {
worker = new ViewWorker();
} else if (pathInfo.startsWith("/view/")) {
worker = new ViewWorker();
} else if (pathInfo.startsWith("/buffalo/")) {
worker = new BuffaloWorker();
} else if (pathInfo.startsWith("/upload/")) {
worker = new UploadWorker();
} else {
throw new ServletException("Cannot find the request worker!");
}
try {
worker.validate(request, response);
} catch (ValidationException ex) {
throw new ServletException("Service validation error", ex);
}
worker.processRequest(request, response);
}