@Override protected ModelAndView handleRequestInternal( HttpServletRequest request, HttpServletResponse response) throws Exception { String pathInfoStr = request.getPathInfo(); String[] pathInfo = pathInfoStr.substring(1).split("/"); String prefix = pathInfo[pathInfo.length - 1]; String reqMethod = request.getMethod(); if (METHOD_HEAD.equals(reqMethod)) { logger.info("HEAD namespace for prefix {}", prefix); Map<String, Object> model = new HashMap<String, Object>(); return new ModelAndView(SimpleResponseView.getInstance(), model); } if (METHOD_GET.equals(reqMethod)) { logger.info("GET namespace for prefix {}", prefix); return getExportNamespaceResult(request, prefix); } else if ("PUT".equals(reqMethod)) { logger.info("PUT prefix {}", prefix); return getUpdateNamespaceResult(request, prefix); } else if ("DELETE".equals(reqMethod)) { logger.info("DELETE prefix {}", prefix); return getRemoveNamespaceResult(request, prefix); } else { throw new ServerHTTPException("Unexpected request method: " + reqMethod); } }
public void setRequestMethod(String method) throws ProtocolException { this.method = method; if (METHOD_GET.equalsIgnoreCase(method)) { req = new HttpGet(url.toString()); } else if (METHOD_HEAD.equalsIgnoreCase(method)) { req = new HttpHead(url.toString()); } else if (METHOD_PUT.equalsIgnoreCase(method)) { req = new HttpPut(url.toString()); } else if (METHOD_POST.equalsIgnoreCase(method)) { req = new HttpPost(url.toString()); } else { this.method = null; throw new UnsupportedOperationException(); } }