Interface WLResponseListener
-
- All Known Implementing Classes:
- ChallengeHandler
public interface WLResponseListener
This interface defines methods that the listener for theWLClient
andChallengeHandler
.WLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
implements to receive notifications about the success or failure of the method call.
-
-
Method Summary
Methods Modifier and Type Method and Description void
onFailure(WLFailResponse response)
This method is called if any failure occurred during the execution of theWLClient.connect(WLResponseListener)
orWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
.void
onSuccess(WLResponse response)
This method is called following successful calls to theWLClient.connect(WLResponseListener)
orWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
.
-
-
-
Method Detail
-
onSuccess
void onSuccess(WLResponse response)
This method is called following successful calls to theWLClient.connect(WLResponseListener)
orWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
.This method is also the success delegate for
ChallengeHandler.submitLoginForm(String, Hashtable, Hashtable, String)
orChallengeHandler.submitAdapterAuthentication(WLProcedureInvocationData, WLRequestOptions)
. ForChallengeHandler
, this method is called when a successful HTTP response is received (200 OK). This method does not indicate whether the challenge was successful or not. A 200 HTTP response can flow back indicating problems with authentication on the server or requesting additional information. Some examples of a 200 HTTP response are as follows:- First init request returns a normal 200 HTTP response that requests a pkms login form
- Authentication failed on the server
- A 200 HTTP response, indicating that the account is locked on the server due to too many failed login attempts
Note: IBM MobileFirst Platform does not attempt to determine what the 200 response means. This is a good place to check whether the response is a custom response and handle it accordingly. If the response is not a custom response, you can call submitSuccess to indicate that all is good from your challenge handler's perspective, and that IBM MobileFirst Platform can handle the response instead.
- Parameters:
response
- The response that the server returns, along with any invocation context object and status.
-
onFailure
void onFailure(WLFailResponse response)
This method is called if any failure occurred during the execution of theWLClient.connect(WLResponseListener)
orWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
.This method is the failure delegate for
com.worklight.wlclient.api.challengehandler.ChallengeHandler#submitLoginForm(String, Map
or, Map , int, String) ChallengeHandler.submitAdapterAuthentication(WLProcedureInvocationData, WLRequestOptions)
. ForChallengeHandler
, this method is called when a response does not have a 200 HTTP status code. This method does not indicate whether the challenge was successful or not. In some cases onFailure is an indication of a normal challenge handling sequence. An example of when the onFailure method is called is when a 401 Unauthorized response is received. A successful handshake can entail several 401 response iterations and therefore several onFailure calls. This behavior is all part of the normal handshake between two parties that are trying to establish identity. IBM MobileFirst Platform handles the handshakes for core challenges iteratively until all of the credentials are established and the necessary challenges are processed. This is a good place to check whether the response is a custom response and handle it accordingly. If the response is not a custom response, you can call submitSuccess to indicate that all is good from your challenge handler's perspective, and that IBM MobileFirst Platform can handle the response instead.- Parameters:
response
- A response that contains the error code and error message. Optionally, it can also contain the results from the server and any invocation context object and status.
-
-