use of com.robo4j.socket.http.message.HttpDecoratedRequest in project robo4j by Robo4J.
the class ChannelRequestBuffer method getHttpDecoratedRequestByChannel.
public HttpDecoratedRequest getHttpDecoratedRequestByChannel(ByteChannel channel) throws IOException {
final StringBuilder sbBasic = new StringBuilder();
int readBytes = channel.read(requestBuffer);
if (readBytes != ChannelBufferUtils.BUFFER_MARK_END) {
requestBuffer.flip();
ChannelBufferUtils.addToStringBuilder(sbBasic, requestBuffer, readBytes);
final HttpDecoratedRequest result = ChannelBufferUtils.extractDecoratedRequestByStringMessage(sbBasic.toString());
ChannelBufferUtils.readChannelBuffer(result, channel, requestBuffer, readBytes);
requestBuffer.clear();
return result;
} else {
return new HttpDecoratedRequest(new HashMap<>(), new HttpRequestDenominator(HttpMethod.GET, HttpVersion.HTTP_1_1));
}
}
Aggregations