本文整理了Java中org.eclipse.jetty.server.Request.getInputStream
方法的一些代码示例,展示了Request.getInputStream
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getInputStream
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getInputStream
暂无
代码示例来源:origin: jphp-group/jphp
@Signature
public Stream bodyStream(Environment env) throws IOException {
return new MiscStream(env, request.getInputStream());
}
代码示例来源:origin: AsyncHttpClient/async-http-client
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
InputStream is = baseRequest.getInputStream();
int read;
do {
// drain upload
read = is.read();
} while (read >= 0);
response.setStatus(200);
response.getOutputStream().flush();
response.getOutputStream().close();
baseRequest.setHandled(true);
}
};
代码示例来源:origin: AsyncHttpClient/async-http-client
@Override
public void handle(String pathInContext, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException {
String redirectHeader = httpRequest.getHeader("X-REDIRECT");
if (redirectHeader != null && !redirectAlreadyPerformed) {
redirectAlreadyPerformed = true;
httpResponse.setStatus(Integer.valueOf(redirectHeader));
httpResponse.setContentLength(0);
httpResponse.setHeader(LOCATION.toString(), getTargetUrl());
} else {
receivedContentType = request.getContentType();
httpResponse.setStatus(200);
int len = request.getContentLength();
httpResponse.setContentLength(len);
if (len > 0) {
byte[] buffer = new byte[len];
IOUtils.read(request.getInputStream(), buffer);
httpResponse.getOutputStream().write(buffer);
}
}
httpResponse.getOutputStream().flush();
httpResponse.getOutputStream().close();
}
};
代码示例来源:origin: jersey/jersey
getSecurityContext(request),
new MapPropertiesDelegate());
requestContext.setEntityStream(request.getInputStream());
final Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
代码示例来源:origin: org.keycloak/keycloak-jetty-adapter-spi
@Override
public InputStream getInputStream(boolean buffered) {
if (inputStream != null) {
return inputStream;
}
if (buffered) {
try {
return inputStream = new BufferedInputStream(request.getInputStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
try {
return request.getInputStream();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
@Override
public InputStream getInputStream(boolean buffered) {
if (inputStream != null) {
return inputStream;
}
if (buffered) {
try {
return inputStream = new BufferedInputStream(request.getInputStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
try {
return request.getInputStream();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: springside/springtime
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
if (!target.startsWith(RPC_PREFIX)) {
return;
}
String path = target.toLowerCase();
Serializer serializerForRequest = serializer;
dispatcher.dispatch(path, serializerForRequest, baseRequest.getInputStream(), response.getOutputStream());
response.setContentType(Serializer.JSON_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
response.getOutputStream().flush();
baseRequest.setHandled(true);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: org.eclipse.jetty/server
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public BufferedReader getReader() throws IOException
{
if (_inputState != __NONE && _inputState != __READER)
throw new IllegalStateException("STREAMED");
if (_inputState == __READER)
return _reader;
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = StringUtil.__ISO_8859_1;
if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
{
final ServletInputStream in = getInputStream();
_readerEncoding = encoding;
_reader = new BufferedReader(new InputStreamReader(in,encoding))
{
@Override
public void close() throws IOException
{
in.close();
}
};
}
_inputState = __READER;
return _reader;
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jetty
@Override
public InputStream getRequestEntityStream(long size) {
try {
return getConnection().getRequest().getInputStream();
} catch (IOException e) {
getLogger().log(Level.WARNING,
"Unable to get request entity stream", e);
return null;
}
}
代码示例来源:origin: org.opendaylight.iotdm/onem2msimpleadapter-impl
@Override
public void handle(String target, Request baseRequest,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException, ServletException {
response = null;
httpRSC = HttpServletResponse.SC_OK;
String method = baseRequest.getMethod().toLowerCase();
String uri = baseRequest.getRequestURI();
String payload = IOUtils.toString(baseRequest.getInputStream()).trim();
LOG.info("handle: received http message: start");
LOG.info("Method {}", method);
LOG.info("URI {}", uri);
LOG.info("RemoteAddr {}", baseRequest.getRemoteAddr());
for (Enumeration<String> e = baseRequest.getHeaderNames(); e.hasMoreElements(); ) {
String header = e.nextElement();
LOG.info("Header: {}, Value: {}", header, baseRequest.getHeader(header));
}
LOG.info("payload: {}", payload);
if (method.compareToIgnoreCase("POST") == 0 || method.compareToIgnoreCase("PUT") == 0) {
processHttpMessage(baseRequest, uri, payload);
}
sendHttpResponse(httpResponse);
baseRequest.setHandled(true);
LOG.info("handle: received http message: end");
}
}
代码示例来源:origin: com.yahoo.vespa/jdisc_http_service
ContentChannel handleRequestFilterResponse(Response response) {
try {
jettyRequest.getInputStream().close();
ContentChannel responseContentChannel = servletResponseController.responseHandler.handleResponse(response);
servletResponseController.finishedFuture().whenComplete(completeRequestCallback);
return responseContentChannel;
} catch (IOException e) {
throw throwUnchecked(e);
}
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
/**
* Read content
*
* @return content
*/
protected byte[] read() {
ByteArrayOutputStream content = new ByteArrayOutputStream();
final byte[] buffer = new byte[8196];
int read;
try {
InputStream input = request.getInputStream();
while ((read = input.read(buffer)) != -1)
content.write(buffer, 0, read);
} catch (IOException e) {
throw new RuntimeException(e);
}
return content.toByteArray();
}
代码示例来源:origin: jenkinsci/winstone
private MultiParts newMultiParts(ServletInputStream inputStream, String contentType, MultipartConfigElement config, Object object) throws IOException
{
MultiPartFormDataCompliance compliance = getHttpChannel().getHttpConfiguration().getMultipartFormDataCompliance();
if(LOG.isDebugEnabled())
LOG.debug("newMultiParts {} {}",compliance, this);
switch(compliance)
{
case RFC7578:
return new MultiParts.MultiPartsHttpParser(getInputStream(), getContentType(), config,
(_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null), this);
case LEGACY:
default:
return new MultiParts.MultiPartsUtilParser(getInputStream(), getContentType(), config,
(_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null), this);
}
}
代码示例来源:origin: com.yahoo.vespa/jdisc_http_service
@SuppressWarnings("try")
private ServletRequestReader handleRequest() throws IOException {
HttpRequest jdiscRequest = HttpRequestFactory.newJDiscRequest(jDiscContext.container, jettyRequest);
ContentChannel requestContentChannel;
try (ResourceReference ref = References.fromResource(jdiscRequest)) {
HttpRequestFactory.copyHeaders(jettyRequest, jdiscRequest);
requestContentChannel = requestHandler.handleRequest(jdiscRequest, servletResponseController.responseHandler);
}
ServletInputStream servletInputStream = jettyRequest.getInputStream();
ServletRequestReader servletRequestReader =
new ServletRequestReader(
servletInputStream,
requestContentChannel,
jDiscContext.janitor,
metricReporter);
servletInputStream.setReadListener(servletRequestReader);
return servletRequestReader;
}
内容来源于网络,如有侵权,请联系作者删除!