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

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

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

Request.getNIOInputStream介绍

[英]Return the NIOInputStream for this Request. This stream will not block when reading content.

NOTE: For now, in order to use non-blocking functionality, this method must be invoked before the HttpHandler#service(Request,Response)method returns. We hope to have this addressed in the next release.
[中]返回此请求的NIInputStream。阅读内容时,此流不会被阻止。
注意:目前,为了使用非阻塞功能,必须在HttpHandler#service(Request,Response)方法返回之前调用此方法。我们希望在下一个版本中解决这个问题。

代码示例

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

/**
 * <p>
 * Return the {@link InputStream} for this {@link Request}.
 * </p>
 * 
 * By default the returned {@link NIOInputStream} will work as blocking
 * {@link InputStream}, but it will be possible to call {@link NIOInputStream#isReady()},
 * {@link NIOInputStream#available()}, or {@link NIOInputStream#notifyAvailable(org.glassfish.grizzly.ReadHandler)}
 * to avoid blocking.
 *
 * @return the {@link NIOInputStream} for this {@link Request}.
 *
 * @exception IllegalStateException if {@link #getReader()} or
 *  {@link #getNIOReader()} has already been called for this request.
 *
 * @since 2.2
 */
public InputStream getInputStream() {
  return getNIOInputStream();
}

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

/**
 * <p>
 * Return the {@link InputStream} for this {@link Request}.
 * </p>
 * 
 * By default the returned {@link NIOInputStream} will work as blocking
 * {@link InputStream}, but it will be possible to call {@link NIOInputStream#isReady()},
 * {@link NIOInputStream#available()}, or {@link NIOInputStream#notifyAvailable(org.glassfish.grizzly.ReadHandler)}
 * to avoid blocking.
 *
 * @return the {@link NIOInputStream} for this {@link Request}.
 *
 * @exception IllegalStateException if {@link #getReader()} or
 *  {@link #getNIOReader()} has already been called for this request.
 *
 * @since 2.2
 */
public InputStream getInputStream() {
  return getNIOInputStream();
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-multipart

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

public MultipartReadHandler(final Request request,
    final MultipartEntryHandler multipartHandler,
    final CompletionHandler<Request> completionHandler,
    final MultipartContext multipartContext) {
  this.request = request;
  this.multipartHandler = multipartHandler;
  this.requestCompletionHandler = completionHandler;
  this.multipartContext = multipartContext;
  this.boundary = multipartContext.getBoundary();
  this.parentInputStream = request.getNIOInputStream();
  multipartMixedCompletionHandler = null;
  multipartMixedEntry = null;
  
  multipartEntry = new MultipartEntry(multipartContext);
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-multipart

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

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

private void finishHeadersParsing() {
  state = State.START_BODY;
  if (isMultipartMixed) {
    multipartEntry.initialize(multipartMixedEntry.getNIOInputStream());
  } else {
    multipartEntry.initialize(request.getNIOInputStream());
  }
  
  final String contentType = multipartEntry.getHeader(Header.ContentType);
  if (contentType != null) {
    multipartEntry.setContentType(contentType);
  }
  final String contentDisposition = multipartEntry.getHeader(Header.ContentDisposition);
  if (contentDisposition != null) {
    multipartEntry.setContentDisposition(
        new ContentDisposition(contentDisposition));
  }
}

相关文章

Request类方法