本文整理了Java中org.glassfish.grizzly.http.server.Request.getReader
方法的一些代码示例,展示了Request.getReader
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getReader
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称:Request
方法名:getReader
[英]Returns the Reader associated with this Request.
By default the returned NIOReader will work as blocking java.io.Reader, but it will be possible to call NIOReader#isReady()or NIOReader#notifyAvailable(org.glassfish.grizzly.ReadHandler)to avoid blocking.
[中]返回与此请求关联的读取器。
默认情况下,返回的NIOReader将充当阻塞java。伊奥。但是可以调用NIOReader#isReady()或NIOReader#notifyAvailable(org.glassfish.grizzly.ReadHandler)以避免阻塞。
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public BufferedReader getReader() throws IOException {
if (usingInputStream)
throw new IllegalStateException("Illegal attempt to call getReader() after getInputStream() has already been called.");
usingReader = true;
//inputBuffer.checkConverter();
if (reader == null) {
reader = new ServletReaderImpl(request.getReader());
}
return reader;
}
代码示例来源:origin: javaee/grizzly
@Override
public void service(Request request, Response response) throws Exception {
final char[] buf = new char[128];
Reader in = null;
Writer out = null;
try {
in = request.getReader(); // put the stream in blocking mode
out = response.getWriter();
int read;
while ((read = in.read(buf)) != -1) {
out.write(buf, 0, read); // echo the contents of 'buf' to the client
}
out.flush();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ignore) {
}
}
if (out != null) {
try {
out.close();
} catch (IOException ignore) {
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!