Class OslcErrors
- Since:
- 1.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn identifier that uniquely identifies an error in the whole application.static classA class used to build OslcError resources. -
Method Summary
Modifier and TypeMethodDescriptionstatic OslcErrors.OslcErrorBuilderbadRequest(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 400 Bad Request error with the given error identifier and message.static OslcErrors.OslcErrorBuilderforbidden(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 403 Forbidden error with the given error identifier and message.static voidLog the given OSLC Error resource, provided aLoggerinstance was associated when creating the Error withOslcResponses.of(OslcError, Logger).static OslcErrors.OslcErrorBuildernotFound(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 404 Not Found error with the given error identifier and message.static OslcErrors.OslcErrorBuilderpreconditionFailed(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 412 Precondition Failed error with the given error identifier and message.static OslcErrors.OslcErrorBuilderserverError(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 500 Internal Server Error with the given error identifier and message.static OslcErrors.OslcErrorBuilderserviceUnavailable(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 503 Service Unavailable error with the given error identifier and message.static OslcErrors.OslcErrorBuilderstatus(int status, OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for the given HTTP status, error identifier and message.static OslcErrors.OslcErrorBuilderstatus(Response.Status status, OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for the given HTTP status, error identifier and message.static OslcErrors.OslcErrorBuilderunauthorized(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 401 Unauthorized error with the given error identifier and message.
-
Method Details
-
status
public static OslcErrors.OslcErrorBuilder status(Response.Status status, OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for the given HTTP status, error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
status- the HTTP status for the response.identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
status
public static OslcErrors.OslcErrorBuilder status(int status, OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for the given HTTP status, error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
status- the HTTP status for the response.identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
badRequest
Creates a new OslcErrorBuilder for an HTTP 400 Bad Request error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
forbidden
Creates a new OslcErrorBuilder for an HTTP 403 Forbidden error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
notFound
Creates a new OslcErrorBuilder for an HTTP 404 Not Found error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
preconditionFailed
public static OslcErrors.OslcErrorBuilder preconditionFailed(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 412 Precondition Failed error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
serverError
public static OslcErrors.OslcErrorBuilder serverError(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 500 Internal Server Error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
unauthorized
public static OslcErrors.OslcErrorBuilder unauthorized(OslcErrors.ErrorId identifier, String message) Creates a new OslcErrorBuilder for an HTTP 401 Unauthorized error with the given error identifier and message.As the OSLC specification does not define an identifier for the Error resource, remote OSLC applications will only display the message. This method automatically prefixes the message by the given identifier, so that it can be visible there.
- Parameters:
identifier- the unique identifier of the error, for the end user to search for corresponding documentation and to report to its support.message- the error message for the end-user.- Returns:
- a new OslcErrorBuilder
-
log
Log the given OSLC Error resource, provided aLoggerinstance was associated when creating the Error withOslcResponses.of(OslcError, Logger).This method logs the Error entity with following log level:
ERROR- if HTTP status is 500 or upper.WARNING- if HTTP status is below 500 and the error has anassociated cause.DEBUG- in any other case.
This method is called by the framework, when serializing a JAX-RS response. Developer should call it on his own only when operating in a non-JAX-RS environment.
- Parameters:
error- the OSLC Error resource whose description is to build.- Since:
- 4.0.0
-