@NotThreadSafe public abstract class AbstractMessageWriter<T extends HttpMessage> extends Object implements NHttpMessageWriter<T>
NHttpMessageWriter
that serves as a base for all message
writer implementations.Modifier and Type | Field and Description |
---|---|
protected CharArrayBuffer |
lineBuf |
protected LineFormatter |
lineFormatter |
protected SessionOutputBuffer |
sessionBuffer |
Constructor and Description |
---|
AbstractMessageWriter(SessionOutputBuffer buffer,
LineFormatter formatter)
Creates an instance of AbstractMessageWriter.
|
AbstractMessageWriter(SessionOutputBuffer buffer,
LineFormatter formatter,
HttpParams params)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
reset()
Resets the writer.
|
void |
write(T message)
Serializes out the HTTP message head.
|
protected abstract void |
writeHeadLine(T message)
Writes out the first line of
HttpMessage . |
protected final SessionOutputBuffer sessionBuffer
protected final CharArrayBuffer lineBuf
protected final LineFormatter lineFormatter
@Deprecated public AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter, HttpParams params)
AbstractMessageWriter(SessionOutputBuffer, LineFormatter)
buffer
- the session output buffer.formatter
- the line formatter.params
- HTTP parameters.public AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter)
buffer
- the session output buffer.formatter
- the line formatter If null
BasicLineFormatter.INSTANCE
will be used.public void reset()
NHttpMessageWriter
reset
in interface NHttpMessageWriter<T extends HttpMessage>
protected abstract void writeHeadLine(T message) throws IOException
HttpMessage
.message
- HTTP message.IOException
public void write(T message) throws IOException, HttpException
NHttpMessageWriter
write
in interface NHttpMessageWriter<T extends HttpMessage>
message
- HTTP message.IOException
- in case of an I/O error.HttpException
- in case the HTTP message is malformed or
violates the HTTP protocol.Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.