Package net.dona.doip.server
Interface DoipProcessor
-
public interface DoipProcessorA DoipProcessor encapsulates the request-processing logic of a DOIP server. When a request comes to the listener of aDoipServer, theprocess(DoipServerRequest, DoipServerResponse)method of the DoipProcessor will be called with an object representing the incoming request and an object representing the outgoing response. The request object may be inspected and the response object may be populated to provide the response. When the process method returns the server will close the request and response objects as necessary, while generally leaving the socket open for other requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidinit(com.google.gson.JsonObject config)Initializes the DoipProcessor according to the supplied configuration object.voidprocess(DoipServerRequest req, DoipServerResponse resp)Process a request and provide a response.default voidshutdown()Shuts down the DoipProcessor.
-
-
-
Method Detail
-
init
default void init(com.google.gson.JsonObject config)
Initializes the DoipProcessor according to the supplied configuration object. This method is called by theDoipServerwhen the DoipServer is constructed usingDoipServer(DoipServerConfig); the configuration must supply a DoipProcessor class name (viaDoipServerConfig.processorClass); the configuration object for the DoipProcessor is given byDoipServerConfig.processorConfig.- Parameters:
config- a configuration JSON object
-
process
void process(DoipServerRequest req, DoipServerResponse resp) throws java.io.IOException
Process a request and provide a response. The supplied request object may be inspected for the details of the request, and the supplied response object may be called to populate the response. It is not necessary to close these objects in this method.- Parameters:
req- the request objectresp- the response object- Throws:
java.io.IOException- if something goes wrong reading or writing, which will cause the DoipServer to end the connection
-
shutdown
default void shutdown()
Shuts down the DoipProcessor. This method may be overridden to clean up any resources used by the DoipProcessor instance. It will be called by theDoipServerif the DoipServer was constructed usingDoipServer(DoipServerConfig).
-
-