Class GXOutboundSuccessResponse
- java.lang.Object
-
- org.gcube.common.gxrest.response.outbound.GXOutboundSuccessResponse
-
public class GXOutboundSuccessResponse extends Object
An outbound success response message for applications.- Author:
- Manuele Simi (ISTI CNR)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Responsebuild()Builds the response to return.static GXOutboundSuccessResponsenewCREATEResponse(URI location)Builds a new response with the CREATE HTTP status.static GXOutboundSuccessResponsenewOKResponse()Builds a new response with the OK HTTP status.GXOutboundSuccessResponseofType(String type)Adds a type to the response message.GXOutboundSuccessResponseofType(javax.ws.rs.core.MediaType type)Adds a type to the response message.GXOutboundSuccessResponsewithContent(InputStream is)Reads from the stream the content to set in the response.GXOutboundSuccessResponsewithContent(Object o)Sets the object as response's content.GXOutboundSuccessResponsewithContent(String message)Sets the message as the response's content.GXOutboundSuccessResponsewithHeader(String name, Object value)Add an arbitrary header.
-
-
-
Method Detail
-
newOKResponse
public static GXOutboundSuccessResponse newOKResponse()
Builds a new response with the OK HTTP status.- Returns:
- the updated response
-
newCREATEResponse
public static GXOutboundSuccessResponse newCREATEResponse(URI location)
Builds a new response with the CREATE HTTP status.- Returns:
- the updated response
-
withContent
public GXOutboundSuccessResponse withContent(Object o) throws IOException
Sets the object as response's content. Any Java type instance for a response entity, that is supported by the runtime can be passed.- Parameters:
o- the content- Returns:
- the updated response
- Throws:
IOException
-
withContent
public GXOutboundSuccessResponse withContent(InputStream is) throws IOException
Reads from the stream the content to set in the response.- Parameters:
is- the stream- Returns:
- the updated response
- Throws:
IOException
-
withContent
public GXOutboundSuccessResponse withContent(String message)
Sets the message as the response's content.- Parameters:
message-- Returns:
- the updated response
-
ofType
public GXOutboundSuccessResponse ofType(javax.ws.rs.core.MediaType type)
Adds a type to the response message.- Parameters:
type-- Returns:
- the updated response
-
ofType
public GXOutboundSuccessResponse ofType(String type)
Adds a type to the response message.- Parameters:
type-- Returns:
- the updated response
-
withHeader
public GXOutboundSuccessResponse withHeader(String name, Object value)
Add an arbitrary header.- Parameters:
name- the name of the headervalue- the value of the header, the header will be serialized using aRuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the class ofvalueor using itstoStringmethod if a header delegate is not available. Ifvalueisnullthen all current headers of the same name will be removed.- Returns:
- the updated response.
-
build
public javax.ws.rs.core.Response build()
Builds the response to return.- Returns:
- the response
-
-