Package net.dona.doip.server
Class DoipServerResponseImpl
java.lang.Object
net.dona.doip.server.DoipServerResponseImpl
- All Implemented Interfaces:
DoipServerResponse
An implementation of
DoipServerResponse used internally by DoipServer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Ensure that the initial segment has been sent to the client.com.google.gson.JsonObjectReturns the entire collection of attributes in the initial segment of the DOIP response.Get anOutDoipMessagefor writing output segments to the client.Returns the status code in the initial segment of the DOIP response.voidsetAttribute(String key, com.google.gson.JsonElement value) Set a single attribute in the initial segment of the response.voidsetAttribute(String key, String value) Set (as a String) a single attribute in the initial segment of the response.voidsetAttributes(com.google.gson.JsonObject attributes) Set the entire collection of attributes in the initial segment of the response.voidSets the status code in the initial segment of the response.voidwriteCompactOutput(com.google.gson.JsonElement output) Write a "compact" single-segment output.protected voidwriteInitialSegment(com.google.gson.JsonElement output)
-
Constructor Details
-
DoipServerResponseImpl
-
-
Method Details
-
setStatus
Description copied from interface:DoipServerResponseSets the status code in the initial segment of the response.- Specified by:
setStatusin interfaceDoipServerResponse- Parameters:
status- the status code
-
getStatus
Description copied from interface:DoipServerResponseReturns the status code in the initial segment of the DOIP response.- Specified by:
getStatusin interfaceDoipServerResponse- Returns:
- the status code in the initial segment of the DOIP response
-
getRequestId
-
setAttribute
Description copied from interface:DoipServerResponseSet a single attribute in the initial segment of the response.- Specified by:
setAttributein interfaceDoipServerResponse- Parameters:
key- the attribute to setvalue- the value of the attribute to be set
-
setAttribute
Description copied from interface:DoipServerResponseSet (as a String) a single attribute in the initial segment of the response.- Specified by:
setAttributein interfaceDoipServerResponse- Parameters:
key- the attribute to setvalue- the value of the attribute to be set
-
setAttributes
public void setAttributes(com.google.gson.JsonObject attributes) Description copied from interface:DoipServerResponseSet the entire collection of attributes in the initial segment of the response.- Specified by:
setAttributesin interfaceDoipServerResponse- Parameters:
attributes- the new value of the entire attributes collection
-
getAttributes
public com.google.gson.JsonObject getAttributes()Description copied from interface:DoipServerResponseReturns the entire collection of attributes in the initial segment of the DOIP response.- Specified by:
getAttributesin interfaceDoipServerResponse- Returns:
- the entire collection of attributes in the initial segment of the DOIP response
-
commit
Description copied from interface:DoipServerResponseEnsure that the initial segment has been sent to the client.- Specified by:
commitin interfaceDoipServerResponse- Throws:
IOException
-
writeInitialSegment
- Throws:
IOException
-
writeCompactOutput
Description copied from interface:DoipServerResponseWrite a "compact" single-segment output. The output is supplied as an "output" property in the JSON of the single segment sent to the client.- Specified by:
writeCompactOutputin interfaceDoipServerResponse- Parameters:
output- the output JSON- Throws:
IOException
-
getOutput
Description copied from interface:DoipServerResponseGet anOutDoipMessagefor writing output segments to the client. This is used for a non-compact output containing multiple segments. This will commit the initial segment, so it will no longer be possible to change the status code or attributes.- Specified by:
getOutputin interfaceDoipServerResponse- Returns:
- an OutDoipMessage for writing output segments.
- Throws:
IOException
-