org.glassfish.grizzly.http.server.Request.getInputStream()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.glassfish.grizzly.http.server.Request.getInputStream方法的一些代码示例,展示了Request.getInputStream的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getInputStream方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称:Request
方法名:getInputStream

Request.getInputStream介绍

[英]Return the InputStream for this Request.
By default the returned NIOInputStream will work as blocking InputStream, but it will be possible to call NIOInputStream#isReady(), NIOInputStream#available(), or NIOInputStream#notifyAvailable(org.glassfish.grizzly.ReadHandler)to avoid blocking.
[中]返回此请求的InputStream。
默认情况下,返回的NIOInputStream将用作阻塞InputStream,但可以调用NIOInputStream#isReady()、NIOInputStream#available()或NIOInputStream#notifyAvailable(org.glassfish.grizzly.ReadHandler)以避免阻塞。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

if (request.getMethod() == Method.HEAD) {
  mapper.readTree(request.getInputStream());
  response.setStatus(HttpStatus.OK_200);
  return;
    if ("priority".equals(context)) {
      AnalystClusterRequest task = mapper.readValue(request.getInputStream(),
          AnalystClusterRequest.class);
      broker.enqueuePriorityTask(task, response);
          .readValue(request.getInputStream(),
              new TypeReference<List<AnalystClusterRequest>>() {
              });
      ByteStreams.copy(request.getInputStream(),
          suspendedProducerResponse.getOutputStream());
    } catch (IOException ioex) {

代码示例来源:origin: jersey/jersey

@Override
public void service(final Request request, final Response response) {
  final ResponseWriter responseWriter = new ResponseWriter(response, configSetStatusOverSendError);
  try {
    logger.debugLog("GrizzlyHttpContainer.service(...) started");
    URI baseUri = getBaseUri(request);
    URI requestUri = getRequestUri(request);
    final ContainerRequest requestContext = new ContainerRequest(baseUri,
        requestUri, request.getMethod().getMethodString(),
        getSecurityContext(request), new GrizzlyRequestPropertiesDelegate(request));
    requestContext.setEntityStream(request.getInputStream());
    for (final String headerName : request.getHeaderNames()) {
      requestContext.headers(headerName, request.getHeaders(headerName));
    }
    requestContext.setWriter(responseWriter);
    requestContext.setRequestScopedInitializer(injectionManager -> {
      injectionManager.<Ref<Request>>getInstance(RequestTYPE).set(request);
      injectionManager.<Ref<Response>>getInstance(ResponseTYPE).set(response);
    });
    appHandler.handle(requestContext);
  } finally {
    logger.debugLog("GrizzlyHttpContainer.service(...) finished");
  }
}

代码示例来源:origin: miltonio/milton2

@Override
  public InputStream getInputStream() throws IOException {
    return wrapped.getInputStream();
  }
});

代码示例来源:origin: miltonio/milton2

@Override
public InputStream getInputStream() throws IOException {
  return wrapped.getInputStream();
}

代码示例来源:origin: javaee/grizzly

@NotNull
@Override
public InputStream getInput() throws IOException {
  return request.getInputStream();
}

代码示例来源:origin: javaee/grizzly-ahc

@Override
public void service(Request request, Response response)
throws Exception {
  int total = 0;
  byte[] bytesIn = new byte[2048];
  InputStream in = request.getInputStream();
  int read;
  while ((read = in.read(bytesIn)) != -1) {
    total += read;
    Thread.sleep(5);
  }
  response.addHeader("X-Total", Integer.toString(total));
}

代码示例来源:origin: bouncestorage/swiftproxy

try (BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8))) {
  while ((line = in.readLine()) != null) {
    if (isTransient) {

代码示例来源:origin: bouncestorage/swiftproxy

if ("put".equals(multiPartManifest)) {
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  try (TeeInputStream tee = new TeeInputStream(request.getInputStream(), buffer, true)) {
    ManifestEntry[] manifest = readSLOManifest(tee);
    validateManifest(manifest, blobStore, authToken);
try (InputStream is = copiedStream != null ? copiedStream : request.getInputStream()) {
  BlobBuilder.PayloadBlobBuilder builder = blobStore.blobBuilder(objectName)
      .userMetadata(metadata)

代码示例来源:origin: jersey/jersey-1.x

private void _service(final Request request, final Response response) {
  final WebApplication _application = application;
  final URI baseUri = getBaseUri(request);
  // TODO: this is terrible, there must be a way to obtain the original request URI!
  String originalURI = UriBuilder.fromPath(
      request.getRequest().getRequestURIRef()
      .getOriginalRequestURIBC().toString(Constants.DEFAULT_HTTP_CHARSET))
      .build().toString();
  String queryString = request.getQueryString();
  if (queryString != null) {
    originalURI = originalURI + "?" + queryString;
  }
  final URI requestUri = baseUri.resolve(originalURI);
  try {
    final ContainerRequest cRequest = new ContainerRequest(_application,
        request.getMethod().getMethodString(), baseUri, requestUri,
        getHeaders(request), request.getInputStream());
    _application.handleRequest(cRequest, new Writer(response));
  } catch (final IOException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: com.sun.jersey/jersey-grizzly2

private void _service(final Request request, final Response response) {
  final WebApplication _application = application;
  final URI baseUri = getBaseUri(request);
  // TODO: this is terrible, there must be a way to obtain the original request URI!
  String originalURI = UriBuilder.fromPath(
      request.getRequest().getRequestURIRef()
      .getOriginalRequestURIBC().toString(Constants.DEFAULT_HTTP_CHARSET))
      .build().toString();
  String queryString = request.getQueryString();
  if (queryString != null) {
    originalURI = originalURI + "?" + queryString;
  }
  final URI requestUri = baseUri.resolve(originalURI);
  try {
    final ContainerRequest cRequest = new ContainerRequest(_application,
        request.getMethod().getMethodString(), baseUri, requestUri,
        getHeaders(request), request.getInputStream());
    _application.handleRequest(cRequest, new Writer(response));
  } catch (final IOException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: org.glassfish.main.core/kernel

.newInstance(req.getContentType(), req.getInputStream());
if (aalogger.isLoggable(Level.FINE)) {
  aalogger.log(Level.FINE, "***** AdminAdapter {0}  *****", req.getMethod());

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-grizzly2-http

@Override
public void service(final Request request, final Response response) {
  final ResponseWriter responseWriter = new ResponseWriter(response, configSetStatusOverSendError);
  try {
    logger.debugLog("GrizzlyHttpContainer.service(...) started");
    URI baseUri = getBaseUri(request);
    URI requestUri = getRequestUri(request);
    final ContainerRequest requestContext = new ContainerRequest(baseUri,
        requestUri, request.getMethod().getMethodString(),
        getSecurityContext(request), new GrizzlyRequestPropertiesDelegate(request));
    requestContext.setEntityStream(request.getInputStream());
    for (final String headerName : request.getHeaderNames()) {
      requestContext.headers(headerName, request.getHeaders(headerName));
    }
    requestContext.setWriter(responseWriter);
    requestContext.setRequestScopedInitializer(injectionManager -> {
      injectionManager.<Ref<Request>>getInstance(RequestTYPE).set(request);
      injectionManager.<Ref<Response>>getInstance(ResponseTYPE).set(response);
    });
    appHandler.handle(requestContext);
  } finally {
    logger.debugLog("GrizzlyHttpContainer.service(...) finished");
  }
}

相关文章

Request类方法