Package org.restheart.exchange
Class MongoResponse
- java.lang.Object
-
- org.restheart.exchange.Exchange<T>
-
- org.restheart.exchange.Response<T>
-
- org.restheart.exchange.ServiceResponse<org.bson.BsonValue>
-
- org.restheart.exchange.BsonResponse
-
- org.restheart.exchange.MongoResponse
-
public class MongoResponse extends BsonResponse
Response implementation used by MongoService and backed by BsonValue that provides simplify methods to deal mongo response- Author:
- Andrea Di Cesare
-
-
Field Summary
-
Fields inherited from class org.restheart.exchange.ServiceResponse
content
-
Fields inherited from class org.restheart.exchange.Exchange
APP_FORM_URLENCODED_TYPE, APPLICATION_PDF_TYPE, HAL_JSON_MEDIA_TYPE, IN_ERROR_KEY, JSON_MEDIA_TYPE, LOGGER, MAX_BUFFERS, MAX_CONTENT_SIZE, MULTIPART_FORM_DATA_TYPE, wrapped
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMongoResponse(io.undertow.server.HttpServerExchange exchange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWarning(String warning)longgetCount()OperationResultgetDbOperationResult()List<String>getWarnings()static MongoResponseinit(io.undertow.server.HttpServerExchange exchange)static MongoResponseof(io.undertow.server.HttpServerExchange exchange)StringreadContent()Reads the content as a String.voidsetCount(long count)voidsetDbOperationResult(OperationResult dbOperationResult)voidsetInError(int code, String message, Throwable t)static Typetype()-
Methods inherited from class org.restheart.exchange.ServiceResponse
getContent, of, setContent
-
Methods inherited from class org.restheart.exchange.Response
getContentType, getContentType, getMDCContext, getStatusCode, setContentType, setContentTypeAsJson, setInError, setMDCContext, setStatusCode
-
Methods inherited from class org.restheart.exchange.Exchange
getExchange, getWrappedExchange, isAccountInRole, isAuthenticated, isAuthenticated, isContentTypeJson, isContentTypeText, isContentTypeXml, isInError, isInError, responseInterceptorsExecuted, setInError, setInError, setResponseInterceptorsExecuted, updateBufferSize
-
-
-
-
Method Detail
-
init
public static MongoResponse init(io.undertow.server.HttpServerExchange exchange)
-
of
public static MongoResponse of(io.undertow.server.HttpServerExchange exchange)
-
type
public static Type type()
-
readContent
public String readContent()
Description copied from class:ServiceResponseReads the content as a String. This method is used by ResponseSender to generate the response content to send to the client.- Overrides:
readContentin classBsonResponse- Returns:
- the content as string
-
getDbOperationResult
public OperationResult getDbOperationResult()
- Returns:
- the dbOperationResult
-
setDbOperationResult
public void setDbOperationResult(OperationResult dbOperationResult)
- Parameters:
dbOperationResult- the dbOperationResult to set
-
addWarning
public void addWarning(String warning)
- Parameters:
warning-
-
setInError
public void setInError(int code, String message, Throwable t)- Overrides:
setInErrorin classBsonResponse- Parameters:
code-message-t-
-
getCount
public long getCount()
- Returns:
- the count
-
setCount
public void setCount(long count)
- Parameters:
count- the count to set
-
-