本文整理了Java中org.glassfish.grizzly.http.server.Request.getPostBody
方法的一些代码示例,展示了Request.getPostBody
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getPostBody
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称:Request
方法名:getPostBody
[英]Gets the POST body of this request.
[中]获取此请求的帖子正文。
代码示例来源:origin: dhfbk/tint
@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);
}
}
代码示例来源:origin: com.xebialabs.restito/restito
/**
* Factory method
*/
public static Call fromRequest(final Request request) {
Call call = new Call();
call.request = request;
call.method = request.getMethod();
call.authorization = request.getAuthorization();
call.uri = request.getRequestURI();
call.contentType = request.getContentType();
call.url = request.getRequestURL().toString();
for (String headerName : request.getHeaderNames()) {
List<String> headers = new ArrayList<>();
request.getHeaders(headerName).forEach(headers::add);
call.headers.put(headerName, headers);
}
call.parameters = new HashMap<>(request.getParameterMap());
try {
call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset());
} catch (IOException e) {
throw new RuntimeException("Problem reading Post Body of HTTP call");
}
return call;
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Read post body in an array.
*/
protected int readPostBody(byte body[], int len)
throws IOException {
Buffer b = coyoteRequest.getPostBody(len).duplicate();
final int length = b.limit() - b.position();
b.get(body, b.position(), length);
return length;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: javaee/grizzly
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-http-server
final Buffer formData = getPostBody(len);
read = formData.remaining();
parameters.processParameters(formData, formData.position(), read);
内容来源于网络,如有侵权,请联系作者删除!