Package org.omegazero.proxy.http
Interface HTTPEngine
- All Superinterfaces:
org.omegazero.http.util.HTTPResponder
- All Known Implementing Classes:
AbstractHTTPEngine
public interface HTTPEngine
extends org.omegazero.http.util.HTTPResponder
HTTP server implementation interface.
An instance of a
An instance of a
HTTPEngine is associated with one connection by a client.-
Field Summary
Fields inherited from interface org.omegazero.http.util.HTTPResponder
EMPTY_BYTE_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called when the connection to the client closes.org.omegazero.net.socket.SocketConnectionReturns theSocketConnectionto the client associated with this instance.voidprocessData(byte[] data) Processes the given data received over the connection from the client.default voidrespondError(org.omegazero.http.common.HTTPRequest request, int status, String message, String... headers) Selects an appropriateHTTPErrdoctemplate and generates a response body using it.voidrespondError(org.omegazero.http.common.HTTPRequest request, int status, String title, String message, String... headers) Selects an appropriateHTTPErrdoctemplate and generates a response body using it.Methods inherited from interface org.omegazero.http.util.HTTPResponder
respond, respond
-
Method Details
-
processData
void processData(byte[] data) Processes the given data received over the connection from the client.- Parameters:
data- Incoming data of a client to process
-
close
void close()Called when the connection to the client closes. -
getDownstreamConnection
org.omegazero.net.socket.SocketConnection getDownstreamConnection()Returns theSocketConnectionto the client associated with this instance.- Returns:
- The
SocketConnectionto the client
-
respondError
default void respondError(org.omegazero.http.common.HTTPRequest request, int status, String message, String... headers) Selects an appropriateHTTPErrdoctemplate and generates a response body using it.The title is selected using
HTTPStatus.getStatusName(int)based on the given status; if the given status is not defined byHTTPStatus, behavior is undefined. The resulting body is sent as a HTTP response with the given status and headers.- Parameters:
request- The request to respond tostatus- The status code of the responsemessage- Error messageheaders- Headers to send in the response. Seefor more informationinvalid reference
#respond(HTTPMessage, int, byte[], String...)- Since:
- 3.6.1
- See Also:
-
respondError
void respondError(org.omegazero.http.common.HTTPRequest request, int status, String title, String message, String... headers) Selects an appropriateHTTPErrdoctemplate and generates a response body using it.The resulting body is sent as a HTTP response with the given status and headers.
- Parameters:
request- The request to respond tostatus- The status code of the responsetitle- Title of the error messagemessage- Error messageheaders- Headers to send in the response. Seefor more informationinvalid reference
#respond(HTTPMessage, int, byte[], String...)- See Also:
-