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.WebApplicationException
createBadRequestException(@NotNull ErrorResponse error)
@NotNull jakarta.ws.rs.WebApplicationException
createBadRequestException(@NotNull IErrorType error, @Nullable java.lang.String state)
jakarta.ws.rs.WebApplicationException
createWebApplicationException(jakarta.ws.rs.core.Response.Status status, IErrorType type, java.lang.String reason)
java.lang.String
errorAsJson(IErrorType type, java.lang.String reason)
java.lang.String
getErrorAsJson(IErrorType type)
java.lang.String
getErrorAsJson(IErrorType type, java.lang.String state, java.lang.String reason)
java.lang.String
getErrorAsQueryString(IErrorType type, java.lang.String state)
java.lang.String
getErrorAsQueryString(IErrorType type, java.lang.String state, java.lang.String reason)
DefaultErrorResponse
getErrorResponse(IErrorType type)
DefaultErrorResponse
getErrorResponse(IErrorType type, java.lang.String state, java.lang.String reason)
java.lang.String
getJsonErrorResponse(IErrorType type)
ErrorMessages
getMessages()
void
setMessages(ErrorMessages messages)
void
validateFeatureEnabled(FeatureFlagType flagType)
-
-
-
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)
-
validateFeatureEnabled
public void validateFeatureEnabled(FeatureFlagType flagType)
-
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)
-
-