本文整理汇总了Java中org.apache.http.io.SessionOutputBuffer类的典型用法代码示例。如果您正苦于以下问题:Java SessionOutputBuffer类的具体用法?Java SessionOutputBuffer怎么用?Java SessionOutputBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionOutputBuffer类属于org.apache.http.io包,在下文中一共展示了SessionOutputBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@Override
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
int buffersize,
final HttpParams params) throws IOException {
if (buffersize == -1) {
buffersize = 8192;
}
SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(
socket,
buffersize,
params);
if (wireLog.isDebugEnabled()) {
outbuffer = new LoggingSessionOutputBuffer(
outbuffer,
new Wire(wireLog),
HttpProtocolParams.getHttpElementCharset(params));
}
return outbuffer;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:DefaultClientConnection.java
示例2: init
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Initializes this connection object with {@link SessionInputBuffer} and
* {@link SessionOutputBuffer} instances to be used for sending and
* receiving data. These session buffers can be bound to any arbitrary
* physical output medium.
* <p>
* This method will invoke {@link #createHttpResponseFactory()},
* {@link #createRequestWriter(SessionOutputBuffer, HttpParams)}
* and {@link #createResponseParser(SessionInputBuffer, HttpResponseFactory, HttpParams)}
* methods to initialize HTTP request writer and response parser for this
* connection.
*
* @param inbuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
final SessionInputBuffer inbuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
if (inbuffer == null) {
throw new IllegalArgumentException("Input session buffer may not be null");
}
if (outbuffer == null) {
throw new IllegalArgumentException("Output session buffer may not be null");
}
this.inbuffer = inbuffer;
this.outbuffer = outbuffer;
if (inbuffer instanceof EofSensor) {
this.eofSensor = (EofSensor) inbuffer;
}
this.responseParser = createResponseParser(
inbuffer,
createHttpResponseFactory(),
params);
this.requestWriter = createRequestWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
inbuffer.getMetrics(),
outbuffer.getMetrics());
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:AbstractHttpClientConnection.java
示例3: serialize
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Writes out the content of the given HTTP entity to the session output
* buffer based on properties of the given HTTP message.
*
* @param outbuffer the output session buffer.
* @param message the HTTP message.
* @param entity the HTTP entity to be written out.
* @throws HttpException in case of HTTP protocol violation.
* @throws IOException in case of an I/O error.
*/
public void serialize(
final SessionOutputBuffer outbuffer,
final HttpMessage message,
final HttpEntity entity) throws HttpException, IOException {
if (outbuffer == null) {
throw new IllegalArgumentException("Session output buffer may not be null");
}
if (message == null) {
throw new IllegalArgumentException("HTTP message may not be null");
}
if (entity == null) {
throw new IllegalArgumentException("HTTP entity may not be null");
}
OutputStream outstream = doSerialize(outbuffer, message);
entity.writeTo(outstream);
outstream.close();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:EntitySerializer.java
示例4: init
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Initializes this connection object with {@link SessionInputBuffer} and
* {@link SessionOutputBuffer} instances to be used for sending and
* receiving data. These session buffers can be bound to any arbitrary
* physical output medium.
* <p>
* This method will invoke {@link #createHttpRequestFactory},
* {@link #createRequestParser(SessionInputBuffer, HttpRequestFactory, HttpParams)}
* and {@link #createResponseWriter(SessionOutputBuffer, HttpParams)}
* methods to initialize HTTP request parser and response writer for this
* connection.
*
* @param inbuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
final SessionInputBuffer inbuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
if (inbuffer == null) {
throw new IllegalArgumentException("Input session buffer may not be null");
}
if (outbuffer == null) {
throw new IllegalArgumentException("Output session buffer may not be null");
}
this.inbuffer = inbuffer;
this.outbuffer = outbuffer;
if (inbuffer instanceof EofSensor) {
this.eofSensor = (EofSensor) inbuffer;
}
this.requestParser = createRequestParser(
inbuffer,
createHttpRequestFactory(),
params);
this.responseWriter = createResponseWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
inbuffer.getMetrics(),
outbuffer.getMetrics());
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:AbstractHttpServerConnection.java
示例5: createSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@Override
protected SessionOutputBuffer createSessionOutputBuffer(final Socket socket, int buffersize, final HttpParams params)
throws IOException
{
if (buffersize == -1)
{
buffersize = 8192;
}
SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(socket, buffersize, params);
if (wireLog.isDebugEnabled())
{
outbuffer =
new LoggingSessionOutputBuffer(outbuffer, new Wire(wireLog),
HttpProtocolParams.getHttpElementCharset(params));
}
return outbuffer;
}
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:18,代码来源:DefaultClientConnection.java
示例6: createSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@Override
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
final int buffersize,
final HttpParams params) throws IOException {
SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(
socket,
buffersize > 0 ? buffersize : 8192,
params);
if (wireLog.isDebugEnabled()) {
outbuffer = new LoggingSessionOutputBuffer(
outbuffer,
new Wire(wireLog),
HttpProtocolParams.getHttpElementCharset(params));
}
return outbuffer;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:DefaultClientConnection.java
示例7: createSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@Override
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
int buffersize,
final HttpParams params) throws IOException {
if (buffersize == -1) {
buffersize = 8192;
}
SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(
socket,
buffersize,
params);
if (wireLog.isDebugEnabled()) {
outbuffer = new LoggingSessionOutputBuffer(outbuffer, new Wire(wireLog));
}
return outbuffer;
}
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:18,代码来源:DefaultClientConnection.java
示例8: acceptClient
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
private void acceptClient(@NotNull Socket client) throws IOException {
final SessionInputBuffer inputBuffer = wrapInputStream(client.getInputStream());
final HttpMessageParser<HttpRequest> parser = new DefaultHttpRequestParser(inputBuffer,
new BasicLineParser(),
new DefaultHttpRequestFactory(),
MessageConstraints.DEFAULT
);
final SessionOutputBuffer outputBuffer = wrapOutputStream(client.getOutputStream());
final HttpMessageWriter<HttpResponse> writer = new DefaultHttpResponseWriter(outputBuffer);
while (!socket.isClosed()) {
try {
service(inputBuffer, outputBuffer, parser, writer);
} catch (ConnectionClosedException ignored) {
break;
} catch (HttpException e) {
log.error(e.getMessage(), e);
break;
}
}
}
开发者ID:bozaro,项目名称:git-as-svn,代码行数:21,代码来源:ProtobufRpcSocket.java
示例9: LoggingSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Create an instance that wraps the specified session output buffer.
* @param out The session output buffer.
* @param wire The Wire log to use.
* @param charset protocol charset, <code>ASCII</code> if <code>null</code>
*/
public LoggingSessionOutputBuffer(
final SessionOutputBuffer out, final Wire wire, final String charset) {
super();
this.out = out;
this.wire = wire;
this.charset = charset != null ? charset : Consts.ASCII.name();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:LoggingSessionOutputBuffer.java
示例10: ContentLengthOutputStream
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Wraps a session output buffer and cuts off output after a defined number
* of bytes.
*
* @param out The session output buffer
* @param contentLength The maximum number of bytes that can be written to
* the stream. Subsequent write operations will be ignored.
*
* @since 4.0
*/
public ContentLengthOutputStream(final SessionOutputBuffer out, long contentLength) {
super();
if (out == null) {
throw new IllegalArgumentException("Session output buffer may not be null");
}
if (contentLength < 0) {
throw new IllegalArgumentException("Content length may not be negative");
}
this.out = out;
this.contentLength = contentLength;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ContentLengthOutputStream.java
示例11: AbstractMessageWriter
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Creates an instance of AbstractMessageWriter.
*
* @param buffer the session output buffer.
* @param formatter the line formatter.
* @param params HTTP parameters.
*/
public AbstractMessageWriter(final SessionOutputBuffer buffer,
final LineFormatter formatter,
final HttpParams params) {
super();
if (buffer == null) {
throw new IllegalArgumentException("Session input buffer may not be null");
}
this.sessionBuffer = buffer;
this.lineBuf = new CharArrayBuffer(128);
this.lineFormatter = (formatter != null) ?
formatter : BasicLineFormatter.DEFAULT;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:AbstractMessageWriter.java
示例12: IdentityOutputStream
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
public IdentityOutputStream(final SessionOutputBuffer out) {
super();
if (out == null) {
throw new IllegalArgumentException("Session output buffer may not be null");
}
this.out = out;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:IdentityOutputStream.java
示例13: createOutputStream
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
protected OutputStream createOutputStream(
final long len,
final SessionOutputBuffer outbuffer) {
if (len == ContentLengthStrategy.CHUNKED) {
return new ChunkedOutputStreamHC4(2048, outbuffer);
} else if (len == ContentLengthStrategy.IDENTITY) {
return new IdentityOutputStreamHC4(outbuffer);
} else {
return new ContentLengthOutputStreamHC4(outbuffer, len);
}
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:12,代码来源:BHttpConnectionBase.java
示例14: AbstractMessageWriterHC4
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Creates an instance of AbstractMessageWriterHC4.
*
* @param buffer the session output buffer.
* @param formatter the line formatter.
* @param params HTTP parameters.
*
* @deprecated (4.3) use
* {@link AbstractMessageWriterHC4#AbstractMessageWriterHC4(SessionOutputBuffer, LineFormatter)}
*/
@Deprecated
public AbstractMessageWriterHC4(final SessionOutputBuffer buffer,
final LineFormatter formatter,
final HttpParams params) {
super();
Args.notNull(buffer, "Session input buffer");
this.sessionBuffer = buffer;
this.lineBuf = new CharArrayBuffer(128);
this.lineFormatter = (formatter != null) ? formatter : BasicLineFormatterHC4.INSTANCE;
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:21,代码来源:AbstractMessageWriterHC4.java
示例15: createOutputStream
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@Override
protected OutputStream createOutputStream(final long len, final SessionOutputBuffer outbuffer) {
if (len == ContentLengthStrategy.CHUNKED) {
return new ChunkedOutputStream(chunkSize, outbuffer);
}
return super.createOutputStream(len, outbuffer);
}
开发者ID:fod-dev,项目名称:FoDBugTrackerUtility,代码行数:8,代码来源:ApacheConnector.java
示例16: LoggingSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
/**
* Create an instance that wraps the specified session output buffer.
* @param out The session output buffer.
* @param wire The Wire log to use.
* @param charset protocol charset, {@code ASCII} if {@code null}
*/
public LoggingSessionOutputBuffer(
final SessionOutputBuffer out, final Wire wire, final String charset) {
super();
this.out = out;
this.wire = wire;
this.charset = charset != null ? charset : Consts.ASCII.name();
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:14,代码来源:LoggingSessionOutputBuffer.java
示例17: service
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void service(@NotNull SessionInputBuffer inputBuffer, @NotNull SessionOutputBuffer outputBuffer, @NotNull HttpMessageParser<HttpRequest> parser, @NotNull HttpMessageWriter<HttpResponse> writer) throws IOException, HttpException {
try {
final HttpRequest request = parser.parse();
final HttpEntity entity;
if (request instanceof HttpEntityEnclosingRequest) {
final EntityDeserializer deserializer = new EntityDeserializer(new LaxContentLengthStrategy());
entity = deserializer.deserialize(inputBuffer, request);
((HttpEntityEnclosingRequest) request).setEntity(entity);
} else {
entity = null;
}
final HttpResponse response = service(request);
if (entity != null) {
entity.getContent().close();
}
if (response.getEntity() != null) {
response.addHeader(HttpHeaders.CONTENT_LENGTH, Long.toString(response.getEntity().getContentLength()));
response.addHeader(response.getEntity().getContentType());
response.addHeader(response.getEntity().getContentEncoding());
}
response.setHeader(HttpHeaders.SERVER, "Protobuf RPC");
writer.write(response);
if (response.getEntity() != null) {
final EntitySerializer serializer = new EntitySerializer(new LaxContentLengthStrategy());
serializer.serialize(outputBuffer, response, response.getEntity());
}
} finally {
outputBuffer.flush();
}
}
开发者ID:bozaro,项目名称:git-as-svn,代码行数:32,代码来源:ProtobufRpcSimpleHttp.java
示例18: HttpResponseWriter
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
public HttpResponseWriter(final SessionOutputBuffer buffer,
final LineFormatter formatter,
final HttpParams params) {
super(buffer, formatter, params);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:HttpResponseWriter.java
示例19: HttpRequestWriter
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
public HttpRequestWriter(final SessionOutputBuffer buffer,
final LineFormatter formatter,
final HttpParams params) {
super(buffer, formatter, params);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:HttpRequestWriter.java
示例20: getSessionOutputBuffer
import org.apache.http.io.SessionOutputBuffer; //导入依赖的package包/类
protected SessionOutputBuffer getSessionOutputBuffer() {
return this.outbuffer;
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:4,代码来源:BHttpConnectionBase.java
注:本文中的org.apache.http.io.SessionOutputBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论