Skip navigation links

Oracle Fusion Middleware Java API Reference for the Oracle Access Management OAuth Service
11g Release 2 Patch Set 3 (11.1.2.3)

E59498-01


oracle.security.idaas.oauth.sdk.response
Class OAuthRestResponse

java.lang.Object
  extended by oracle.security.idaas.oauth.sdk.response.OAuthRestResponse

Direct Known Subclasses:
AccessTokenValidationResponse, OAuthTokenResponse

public abstract class OAuthRestResponse
extends java.lang.Object

Base class handling the OAuth response. It creates the corresponding JSON object and handles the error and the error message if any. A status equals to 200 means that the request completed successfully.


Field Summary

protected  org.codehaus.jettison.json.JSONObject tok
          Formatted response object.

  Constructor Summary

OAuthRestResponse(int status, java.lang.String response)
          Analyzes and formats the response.

  Method Summary

 java.lang.String getErrorMessage()
          Returns the error message if any.
 int getStatus()
           
 boolean isError()
          Returns true if the response is an error.
protected abstract  void parseResponse(java.lang.String result)
          Computes the response and format it as a JSON object.
protected  void setErrorMessage(java.lang.String message)
          Updates the error message.
 java.lang.String toString()
           

  Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

tok

protected org.codehaus.jettison.json.JSONObject tok
Formatted response object.

Constructor Detail

OAuthRestResponse

public OAuthRestResponse(int status,
                         java.lang.String response)
                  throws org.codehaus.jettison.json.JSONException
Analyzes and formats the response.
Parameters:
status - response status (200 means successful)
response - the response message if the request is successful, else the error message
Throws:
org.codehaus.jettison.json.JSONException - if at least one of the mandatory element in the response is missing, or if the response is not formatted correctly.

Method Detail

isError

public boolean isError()
Returns true if the response is an error. Two cases are possible:
Returns:
true if error response

parseResponse

protected abstract void parseResponse(java.lang.String result)
                               throws org.codehaus.jettison.json.JSONException
Computes the response and format it as a JSON object.
Parameters:
result - string to decode
Throws:
org.codehaus.jettison.json.JSONException - if at least one of the mandatory element in the response is missing, or if the response is not formatted correctly.

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message if any.
Returns:
error message

setErrorMessage

protected void setErrorMessage(java.lang.String message)
Updates the error message.
Parameters:
message - the desired text

getStatus

public int getStatus()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Skip navigation links

Copyright (c) 2014, 2015,
Oracle and/or its affiliates. All Rights Reserved.