本文整理汇总了Java中org.apache.coyote.Request类的典型用法代码示例。如果您正苦于以下问题:Java Request类的具体用法?Java Request怎么用?Java Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Request类属于org.apache.coyote包,在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req)
throws IOException {
if (endOfStream) {
return -1;
}
if (first && req.getContentLengthLong() > 0) {
// Handle special first-body-chunk
if (!receive()) {
return 0;
}
} else if (empty) {
if (!refillReadBuffer()) {
return -1;
}
}
ByteChunk bc = bodyBytes.getByteChunk();
chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
empty = true;
return chunk.getLength();
}
示例2: InternalAprInputBuffer
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Alternate constructor.
*/
public InternalAprInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
buf = new byte[headerBufferSize];
if (headerBufferSize < (8 * 1024)) {
bbuf = ByteBuffer.allocateDirect(6 * 1500);
} else {
bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
}
inputStreamInputBuffer = new SocketInputBuffer();
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
swallowInput = true;
}
示例3: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill())
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
示例4: InternalNioInputBuffer
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Alternate constructor.
*/
public InternalNioInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
this.headerBufferSize = headerBufferSize;
inputStreamInputBuffer = new SocketInputBuffer();
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
parsingRequestLine = true;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
parsingRequestLineQPos = -1;
headerParsePos = HeaderParsePosition.HEADER_START;
headerData.recycle();
swallowInput = true;
}
示例5: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill(true,true)) //read body, must be blocking, as the thread is inside the app
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
示例6: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (endOfStream) {
return -1;
}
if (first && req.getContentLength() > 0) {
// Handle special first-body-chunk
if (!receive()) {
return 0;
}
} else if (empty) {
if (!refillReadBuffer()) {
return -1;
}
}
ByteChunk bc = bodyBytes.getByteChunk();
chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
empty = true;
return chunk.getLength();
}
示例7: AjpProcessor
import org.apache.coyote.Request; //导入依赖的package包/类
public AjpProcessor(int packetSize, JIoEndpoint endpoint) {
this.endpoint = endpoint;
request = new Request();
request.setInputBuffer(new SocketInputBuffer());
response = new Response();
response.setHook(this);
response.setOutputBuffer(new SocketOutputBuffer());
request.setResponse(response);
requestHeaderMessage = new AjpMessage(packetSize);
responseHeaderMessage = new AjpMessage(packetSize);
bodyMessage = new AjpMessage(packetSize);
// Set the get body message buffer
AjpMessage getBodyMessage = new AjpMessage(16);
getBodyMessage.reset();
getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
getBodyMessage.appendInt(packetSize - Constants.READ_HEAD_LEN);
getBodyMessage.end();
getBodyMessageArray = new byte[getBodyMessage.getLen()];
System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray,
0, getBodyMessage.getLen());
// Cause loading of HexUtils
int foo = HexUtils.DEC[0];
// Cause loading of HttpMessages
HttpMessages.getMessage(200);
}
示例8: InternalAprInputBuffer
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Alternate constructor.
*/
public InternalAprInputBuffer(Request request, int headerBufferSize, AprEndpoint endpoint) {
this.request = request;
this.endpoint = endpoint;
headers = request.getMimeHeaders();
buf = new byte[headerBufferSize];
if (headerBufferSize < (8 * 1024)) {
bbuf = ByteBuffer.allocateDirect(6 * 1500);
} else {
bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
}
inputStreamInputBuffer = new SocketInputBuffer();
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
swallowInput = true;
}
示例9: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill())
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
示例10: Http11Processor
import org.apache.coyote.Request; //导入依赖的package包/类
public Http11Processor(int headerBufferSize, JIoEndpoint endpoint) {
this.endpoint = endpoint;
request = new Request();
inputBuffer = new InternalInputBuffer(request, headerBufferSize);
request.setInputBuffer(inputBuffer);
response = new Response();
response.setHook(this);
outputBuffer = new InternalOutputBuffer(response, headerBufferSize);
response.setOutputBuffer(outputBuffer);
request.setResponse(response);
initializeFilters();
// Cause loading of HexUtils
int foo = HexUtils.DEC[0];
// Cause loading of FastHttpDateFormat
FastHttpDateFormat.getCurrentDate();
}
示例11: InternalAprInputBuffer
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Alternate constructor.
*/
public InternalAprInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
buf = new byte[headerBufferSize];
if (headerBufferSize < (8 * 1024)) {
bbuf = ByteBuffer.allocateDirect(6 * 1500);
} else {
bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
}
inputStreamInputBuffer = new SocketInputBuffer();
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
swallowInput = true;
}
示例12: InternalNioInputBuffer
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Alternate constructor.
*/
public InternalNioInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
this.headerBufferSize = headerBufferSize;
inputStreamInputBuffer = new SocketInputBuffer();
filterLibrary = new InputFilter[0];
activeFilters = new InputFilter[0];
lastActiveFilter = -1;
parsingHeader = true;
parsingRequestLine = true;
parsingRequestLinePhase = 0;
parsingRequestLineEol = false;
parsingRequestLineStart = 0;
parsingRequestLineQPos = -1;
headerParsePos = HeaderParsePosition.HEADER_START;
headerData.recycle();
swallowInput = true;
}
示例13: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req) throws IOException {
if (pos >= lastValid) {
if (!fill(true, true)) // read body, must be blocking, as the
// thread is inside the app
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
示例14: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read some bytes.
*/
@Override
public int doRead(ByteChunk chunk, Request req)
throws IOException {
if (lastActiveFilter == -1)
return inputStreamInputBuffer.doRead(chunk, req);
else
return activeFilters[lastActiveFilter].doRead(chunk,req);
}
示例15: doRead
import org.apache.coyote.Request; //导入依赖的package包/类
/**
* Read bytes.
*
* @return If the filter does request length control, this value is
* significant; it should be the number of bytes consumed from the buffer,
* up until the end of the current request body, or the buffer length,
* whichever is greater. If the filter does not do request body length
* control, the returned value should be -1.
*/
@Override
public int doRead(ByteChunk chunk, Request req)
throws IOException {
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
int nRead = buffer.doRead(chunk, req);
if (nRead > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
} else {
result = nRead;
}
if (nRead > 0) {
remaining = remaining - nRead;
}
} else {
// No more bytes left to be read : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
}
return result;
}