public interface ContentHandler
By default the WebServerHandler
consumes the complete payload of a request and offers it via
WebContext.getContent()
. Multipart forms are directly accessible via
WebContext.get(String)
.
If however, the content needs to be processed manually, a pre-dispatchable dispatcher
(WebDispatcher.preparePreDispatch(WebContext)
can handle the request before the content is processed
completely. While being pre-dispatched WebContext.setContentHandler(ContentHandler)
can be used to
install a content handler which takes care of the request payload. Note that
WebDispatcher.dispatch(WebContext)
will not be called for requests which were pre-dispatched.
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Invoked once the request is completely handled or the underlying channel was closed.
|
void |
handle(ByteBuf content,
boolean last)
Handles the given chunk of data.
|
void handle(ByteBuf content, boolean last) throws IOException
content
- the data sent by the client. The buffer might be of size 0 but not null.last
- a flag signalling if this will be the last chunk of dataIOException
- if case of an error (e.g. response already sent...)void cleanup() throws IOException
Can be used to release all internal buffers.
IOException
- in case of an internal errorCopyright © 2018. All rights reserved.