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.http
Class HttpResponse

java.lang.Object
  extended by oracle.security.idaas.oauth.sdk.http.HttpResponse


public class HttpResponse
extends java.lang.Object

Defines an object to assist am HTTP connection handler in sending a response to the client. The HttpResponse object is created as the result of a request initiated by an HTTP connection.


Method Summary

 void close()
          Close the connection.
 java.lang.String getErrorAsString(java.lang.String encoding)
          Returns a String formatted error message when the status is different from 200.
 java.lang.String getHeader(java.lang.String name)
          Returns the value of a parameter in the response header using the given name.
 java.lang.String getResponseBodyAsString(java.lang.String encoding)
          Returns the body of the response as a String.
 int getStatus()
          Returns the status of the request.

  Methods inherited from class java.lang.Object

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

 

Method Detail

close

public void close()
           throws java.io.IOException
Close the connection.
Throws:
java.io.IOException - if an I/O error occurs.

getHeader

public java.lang.String getHeader(java.lang.String name)
Returns the value of a parameter in the response header using the given name.
Parameters:
name - of the parameter
Returns:
string formatted header value

getStatus

public int getStatus()
Returns the status of the request. 200 means successful.

In case the status is not available this method returns 404.

Returns:
the status of the request

getResponseBodyAsString

public java.lang.String getResponseBodyAsString(java.lang.String encoding)
                                         throws java.io.IOException
Returns the body of the response as a String.
Parameters:
encoding - code format
Returns:
string formatted response content
Throws:
java.io.IOException - if an I/O error occurs.

getErrorAsString

public java.lang.String getErrorAsString(java.lang.String encoding)
                                  throws java.io.IOException
Returns a String formatted error message when the status is different from 200. The String contains the error response header (one attribute per line) and the message.
Parameters:
encoding - code format
Returns:
string formatted of the error content
Throws:
java.io.IOException - if an I/O error occurs.

Skip navigation links

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