public OTPRequest (Request req, Graph graph) { this.graph = graph; for (String key : req.getParameterNames()) { params.put(key, req.getParameter(key)); } String path = req.getPathInfo(); sfmt = SerializeFormat.JSON; if (req.getHeader("Accept").contains("application/xml")) { sfmt = SerializeFormat.XML; } if (req.getHeader("Accept").contains("application/json")) { sfmt = SerializeFormat.JSON; } if (path.endsWith(".xml")) { path = path.substring(0, path.length() - 4); sfmt = SerializeFormat.XML; }; if (path.endsWith(".json")) { path = path.substring(0, path.length() - 5); sfmt = SerializeFormat.JSON; }; parts = path.split("/"); // path always begins with a slash, so part 0 is empty if (parts.length > 1) action = parts[1]; if (parts.length > 2) id = parts[2]; }
@Override public String run() { return request.getParameter(name); } }
@Override public String run() { return request.getParameter(name); } }
@Override public String run() { return request.getParameter(name); } }
@Override public String run() { return request.getParameter(name); } }
@Override public String run() { return request.getParameter(name); } }
@Override public String run() { return request.getParameter(name); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
/** * Return the value of the specified request parameter, if any; otherwise, * return <code>null</code>. If there is more than one value defined, * return only the first one. * * @param name Name of the desired request parameter */ @Override public String getParameter(String name) { /* if (!requestParametersParsed) { parseRequestParameters(); } */ processParameters(); return coyoteRequest.getParameter(name); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public String getParameter(String name) { if (request == null) { throw new IllegalStateException("Null request object"); } if (System.getSecurityManager() != null){ return AccessController.doPrivileged( new GetParameterPrivilegedAction(name)); } else { return request.getParameter(name); } }
@Override public void service(Request request, Response response) throws Exception { request.setCharacterEncoding("UTF-8"); Buffer postBody = request.getPostBody(1024); String text = postBody.toStringContent(); if (request.getParameter("text") != null) { text = request.getParameter("text"); } String outputFormat = request.getParameter("format"); InputStream inputStream = new ByteArrayInputStream(text.getBytes()); OutputStream outputStream = new ByteArrayOutputStream(); TintRunner.OutputFormat format = TintRunner.getOutputFormat(outputFormat, TintRunner.OutputFormat.JSON); pipeline.run(inputStream, outputStream, format); LOGGER.debug("Text: {}", text); String output = outputStream.toString(); writeOutput(response, contentTypes.get(format), output); } }