@Dependent public class DefaultRestSecurityErrorCallback extends Object implements RestErrorCallback
RestErrorCallback
that catches UnauthenticatedExceptions
and UnauthorizedExceptions
and navigates to the page with the LoginPage
or SecurityError
role, respectively.
Optionally, this class can wrap a given RestErrorCallback
that it
will call first, in which case this class will only perform the actions
described above if the wrapped callback returns true.Constructor and Description |
---|
DefaultRestSecurityErrorCallback(RestErrorCallback wrapped,
SecurityContext context)
Create a
DefaultRestSecurityErrorCallback wrapping a given
RestErrorCallback . |
DefaultRestSecurityErrorCallback(SecurityContext context)
Create a
DefaultRestSecurityErrorCallback . |
Modifier and Type | Method and Description |
---|---|
boolean |
error(com.google.gwt.http.client.Request message,
Throwable throwable)
Called when an error occurs on the bus.
|
RestErrorCallback |
setWrappedErrorCallback(RestErrorCallback wrapped)
Set the wrapped callback that will be invoked first when
RestErrorCallback#error(Request, Throwable) is called. |
public DefaultRestSecurityErrorCallback(RestErrorCallback wrapped, SecurityContext context)
DefaultRestSecurityErrorCallback
wrapping a given
RestErrorCallback
.wrapped
- The wrapped callback (should never be null
, that will be
invoked first when
RestErrorCallback#error(Request, Throwable)
is called. If
the error method on the wrapped
returns false
, the
whole callback returns false
immediately.context
- The SecurityContext
.@Inject public DefaultRestSecurityErrorCallback(SecurityContext context)
DefaultRestSecurityErrorCallback
.context
- The SecurityContext
.public boolean error(com.google.gwt.http.client.Request message, Throwable throwable) throws MissingPageRoleException
ErrorCallback
error
in interface ErrorCallback<com.google.gwt.http.client.Request>
message
- The message or request for which the failure occurred.throwable
- The exception thrown or null if not availableMissingPageRoleException
public RestErrorCallback setWrappedErrorCallback(RestErrorCallback wrapped)
RestErrorCallback#error(Request, Throwable)
is called. If the error
method on the wrapped callback returns false
, the whole callback
returns false
immediately.wrapped
- The wrapped callback. Passing in null
clears any previous
wrapped callback.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.