8dffc69e by Adam Heath

Issue #4170: Refactor use of pathInfo/contentType/getPathInfo()/getContentType().

1 parent ba0e1190
......@@ -97,11 +97,12 @@ public class DirectControlServlet extends HttpServlet {
}
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pathInfo = request.getPathInfo();
String contentType = request.getContentType();
try {
Debug.logInfo("getPathInfo: " + request.getPathInfo() +
" request.getContentType: " + request.getContentType(), module);
Debug.logInfo("getPathInfo: " + pathInfo +
" request.getContentType: " + contentType, module);
String pathInfo = request.getPathInfo();
if (pathInfo == null || pathInfo.length() == 0) {
return;
}
......@@ -109,7 +110,6 @@ public class DirectControlServlet extends HttpServlet {
// Determine type of request and load the context from JSON content or
// parameter values accordingly
String contentType = request.getContentType();
// Determine the request method for service lookup and parameter filters
String method = "";
......@@ -129,8 +129,8 @@ public class DirectControlServlet extends HttpServlet {
}
} else {
// Check if the request is a backbone style "emulateJSON" request
if (request.getContentType() != null &&
request.getContentType().indexOf("x-www-form-urlencoded") != -1 &&
if (contentType != null &&
contentType.indexOf("x-www-form-urlencoded") != -1 &&
request.getParameter("model") != null) {
Debug.logInfo("MODEL: " + request.getParameter("model"), module);
JSON json = new JSON(new StringReader(request.getParameter("model")));
......