Package io.jans.as.model.error
Class ErrorResponseFactory
- java.lang.Object
-
- io.jans.as.model.error.ErrorResponseFactory
-
- All Implemented Interfaces:
Configuration
public class ErrorResponseFactory extends java.lang.Object implements Configuration
Provides an easy way to get Error responses based in an error response type- Version:
- August 20, 2019
- Author:
- Yuriy Zabrovarnyy, Javier Rojas Blum, Yuriy Movchan
-
-
Constructor Summary
Constructors Constructor Description ErrorResponseFactory()ErrorResponseFactory(ErrorMessages messages, AppConfiguration appConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull jakarta.ws.rs.WebApplicationExceptioncreateBadRequestException(@NotNull ErrorResponse error)@NotNull jakarta.ws.rs.WebApplicationExceptioncreateBadRequestException(@NotNull IErrorType error, @Nullable java.lang.String state)jakarta.ws.rs.WebApplicationExceptioncreateWebApplicationException(jakarta.ws.rs.core.Response.Status status, IErrorType type, java.lang.String reason)java.lang.StringerrorAsJson(IErrorType type, java.lang.String reason)java.lang.StringgetErrorAsJson(IErrorType type)java.lang.StringgetErrorAsJson(IErrorType type, java.lang.String state, java.lang.String reason)java.lang.StringgetErrorAsQueryString(IErrorType type, java.lang.String state)java.lang.StringgetErrorAsQueryString(IErrorType type, java.lang.String state, java.lang.String reason)DefaultErrorResponsegetErrorResponse(IErrorType type)DefaultErrorResponsegetErrorResponse(IErrorType type, java.lang.String state, java.lang.String reason)java.lang.StringgetJsonErrorResponse(IErrorType type)ErrorMessagesgetMessages()voidsetMessages(ErrorMessages messages)voidvalidateComponentEnabled(ComponentType componentType)
-
-
-
Constructor Detail
-
ErrorResponseFactory
public ErrorResponseFactory()
-
ErrorResponseFactory
public ErrorResponseFactory(ErrorMessages messages, AppConfiguration appConfiguration)
-
-
Method Detail
-
getMessages
public ErrorMessages getMessages()
-
setMessages
public void setMessages(ErrorMessages messages)
-
getErrorAsJson
public java.lang.String getErrorAsJson(IErrorType type)
-
errorAsJson
public java.lang.String errorAsJson(IErrorType type, java.lang.String reason)
-
validateComponentEnabled
public void validateComponentEnabled(ComponentType componentType)
-
createWebApplicationException
public jakarta.ws.rs.WebApplicationException createWebApplicationException(jakarta.ws.rs.core.Response.Status status, IErrorType type, java.lang.String reason) throws jakarta.ws.rs.WebApplicationException- Throws:
jakarta.ws.rs.WebApplicationException
-
createBadRequestException
@NotNull public @NotNull jakarta.ws.rs.WebApplicationException createBadRequestException(@NotNull @NotNull ErrorResponse error)
-
createBadRequestException
@NotNull public @NotNull jakarta.ws.rs.WebApplicationException createBadRequestException(@NotNull @NotNull IErrorType error, @Nullable @Nullable java.lang.String state)
-
getErrorAsJson
public java.lang.String getErrorAsJson(IErrorType type, java.lang.String state, java.lang.String reason)
-
getErrorAsQueryString
public java.lang.String getErrorAsQueryString(IErrorType type, java.lang.String state)
-
getErrorAsQueryString
public java.lang.String getErrorAsQueryString(IErrorType type, java.lang.String state, java.lang.String reason)
-
getErrorResponse
public DefaultErrorResponse getErrorResponse(IErrorType type, java.lang.String state, java.lang.String reason)
-
getErrorResponse
public DefaultErrorResponse getErrorResponse(IErrorType type)
-
getJsonErrorResponse
public java.lang.String getJsonErrorResponse(IErrorType type)
-
-