Class HttpStatusEntryPoint
java.lang.Object
com.codename1.backend.security.HttpStatusEntryPoint
- All Implemented Interfaces:
AuthenticationEntryPoint
Answers with a status and a body in the shape of Spring Boot's default error body:
new HttpStatusEntryPoint(401) for an API whose clients know how to
authenticate without being told.
The body is {"timestamp":..,"status":401,"error":"Unauthorized","path":"/x"},
the shape of Boot's /error responses. This differs from Spring on purpose:
Spring's entry point only sets the status, so Boot sends no body. An empty
body broke clients that read the error body -- a
Codename One client's RequestBuilder reports an error code while reading
it, so with Content-Length: 0 no error callback ever saw the 401
(issue 6353).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommence(HttpServer.Request request, AuthenticationException authException) The answer.
-
Constructor Details
-
HttpStatusEntryPoint
public HttpStatusEntryPoint(int status)
-
-
Method Details
-
commence
public HttpServer.Response commence(HttpServer.Request request, AuthenticationException authException) Description copied from interface:AuthenticationEntryPointThe answer.- Specified by:
commencein interfaceAuthenticationEntryPoint- Parameters:
authException- why the request was not let through
-