Context containing information needed to service the request, such as the parent actor
This method is overridden by the end-user to execute the requests served by this resource.
This method is overridden by the end-user to execute the requests served by this resource. The ParsedRequest object will be sent to this message from ResourceActor via a tell. As an actor will be spun up for each request, it is safe to store mutable state during this receive function. When the request is finished, one of the provided complete methods must be called
This receive should handle
ProcessRequest(_)
messages.
ProcessRequest(_) }}}
The receive function to be applied when a parsed request object or other actor message is received
A list of content types that that this server can accept, by default application/json
.
A list of content types that that this server can accept, by default application/json
.
These will be matched against the Content-Type
header of incoming requests.
a list of content types
This method will always be invoked after request processing is finished.
This method will always be invoked after request processing is finished.
If the method throws, the error will be logged and the given response will still be returned. As always, personally identifiable information should never be included in exception messages.
The response to be returned to the client
This method will always be invoked before request processing begins.
This method will always be invoked before request processing begins. It is primarily provided for metrics tracking.
If the method throws, an internal server error will be returned. As always, personally identifiable information should never be included in exception messages.
The Http method of the request in question
Complete a successful request
Complete a successful request
The HttpResponse to be returned
Value for the HTTP location header
Complete a successful request
Complete a successful request
The HttpResponse to be returned
Complete a successful request with a JSON response
Complete a successful request with a JSON response
Type of the object to be returned
Status code to return
Object to be serialized in the response
Value for the HTTP Location header
Complete a successful request with a JSON response
Complete a successful request with a JSON response
Type of the object to be returned
Status code to return
Object to be serialized in the response
Exception handler for creating an http error response when Status.Failure is received.
Exception handler for creating an http error response when Status.Failure is received.
the exception
a crafted HttpResponse from the error message
The receive function for this resource.
The receive function for this resource. Should not be overridden - implement resourceReceive instead
The content type that this server provides, by default application/json
The content type that this server provides, by default application/json
a list of content types
The language of the data in the response, to for the Content-Language header
The language of the data in the response, to for the Content-Language header
a spray.http.Language value in an Option, or None, if the Content-Language header does not need to be set for this resource
Return an internal server error in response to a throwable
Return an internal server error in response to a throwable
The error to be logged
Return an error with the specified Status code
Return an error with the specified Status code
The error code to return
Return an error with the specified Status code
Return an error with the specified Status code
The error code to return
Message to be returned, will be converted to JSON
Return an error with the specified status code and error object.
Return an error with the specified status code and error object.
Type of the error
The error code to return
Error to return, will be converted to JSON
Base class for HTTP resources built with Spray.