Package com.azwul.api.model.result

Source Code of com.azwul.api.model.result.HttpResult

/**
*
*/
package com.azwul.api.model.result;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.httpclient.HttpMethod;

import com.azwul.api.exception.AzwulApiException;
import com.azwul.api.model.SessionToken;

/**
* @author Theotime Jurzak
*
*/
public class HttpResult {

  protected HttpMethod httpMethod;

  protected SessionToken sessionToken;

  /**
   * @return the sessionToken
   */
  public SessionToken getSessionToken() {
    return sessionToken;
  }

  /**
   * @param sessionToken
   *            the sessionToken to set
   */
  public void setSessionToken(SessionToken sessionToken) {
    this.sessionToken = sessionToken;
  }

  /**
   * @return the httpResponse
   */
  public InputStream getHttpResponse() {
    try {
      return httpMethod.getResponseBodyAsStream();
    } catch (IOException e) {
      throw new AzwulApiException("Error reading http response stream", e);
    }
  }

  /**
   * @return the httpMethod
   */
  public HttpMethod getHttpMethod() {
    return httpMethod;
  }

  /**
   * @param httpMethod
   *            the httpMethod to set
   */
  public void setHttpMethod(HttpMethod httpMethod) {
    this.httpMethod = httpMethod;
  }

  /**
   *
   */
  public void releaseConnection() {
    httpMethod.releaseConnection();
  }

}
TOP

Related Classes of com.azwul.api.model.result.HttpResult

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.