Class AbstractConnectionHandler
java.lang.Object
com.github.toolarium.network.server.handler.impl.AbstractConnectionHandler
- All Implemented Interfaces:
IHttpConnectionHandler,Runnable
- Direct Known Subclasses:
HttpConnectionHandlerImpl
Implements the abstract base class for
IHttpConnectionHandler.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IHttpResponsecreateHttpResponse(IHttpRequest request) create a http responseprotected StringgetBodyAsByteArray(IHttpResponse response) Get the body as byte arrayprotected StringgetStatusLineAndHeaders(IHttpResponse response) Get the status line and headersprotected StringreadInBody(BufferedReader reader, int contentLength) Read in the bodyprotected StringreadInFirstLine(BufferedReader br, HttpRequest request) Read the first lineMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.toolarium.network.server.handler.IHttpConnectionHandler
init
-
Constructor Details
-
AbstractConnectionHandler
public AbstractConnectionHandler()
-
-
Method Details
-
readInFirstLine
Read the first line- Parameters:
br- the readerrequest- the request- Returns:
- the first line
- Throws:
IOException- In case of an I/O error
-
readInBody
Read in the body- Parameters:
reader- the readercontentLength- the content length- Returns:
- the body
- Throws:
IOException- In case of an I/O error
-
createHttpResponse
create a http response- Parameters:
request- the reuqest- Returns:
- the response object
-
getStatusLineAndHeaders
Get the status line and headers- Parameters:
response- the http response- Returns:
- the status line and headers
-
getBodyAsByteArray
Get the body as byte array- Parameters:
response- the http response- Returns:
- the body as byte array
-