vle.domain.webservice.http.impl
Class HttpRestTransportImpl

java.lang.Object
  extended by vle.domain.webservice.http.impl.HttpRestTransportImpl
All Implemented Interfaces:
HttpRestTransport

public class HttpRestTransportImpl
extends Object
implements HttpRestTransport

Thread-safe Http transport implementation which uses the Jakarta Commons HttpClient package. See http://jakarta.apache.org/commons/httpclient/

Version:
$Id$
Author:
Cynick Young

Field Summary
 
Fields inherited from interface vle.domain.webservice.http.HttpRestTransport
APPLICATION_XML
 
Constructor Summary
HttpRestTransportImpl()
          Constructs a newly allocated HttpRestTransportImpl object.
 
Method Summary
 InputStream get(HttpGetRequest httpGetRequestData)
          Performs the GET operation given the data required for the get.
 String getBaseUrl()
          Get the base url bound to this HTTP transport.
 org.apache.commons.httpclient.methods.PostMethod post(HttpPostRequest httpPostRequestData)
          Performs the POST operation given the data required for the post.
 Map<String,String> put(HttpPutRequest httpPutRequestData)
          Performs the PUT operation given the data required for the put.
 void setBaseUrl(String baseUrl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpRestTransportImpl

public HttpRestTransportImpl()
Constructs a newly allocated HttpRestTransportImpl object.

Method Detail

getBaseUrl

public String getBaseUrl()
Description copied from interface: HttpRestTransport
Get the base url bound to this HTTP transport.

Specified by:
getBaseUrl in interface HttpRestTransport
Returns:
the baseUrl
See Also:
net.sf.sail.webapp.domain.webservice.http.HttpRestTransport#getBaseUrl()

setBaseUrl

public void setBaseUrl(String baseUrl)
Parameters:
baseUrl - the baseUrl to set

get

public InputStream get(HttpGetRequest httpGetRequestData)
                throws HttpStatusCodeException
Description copied from interface: HttpRestTransport
Performs the GET operation given the data required for the get.

Specified by:
get in interface HttpRestTransport
Parameters:
httpGetRequestData - All the data required for this get request.
Returns:
An InputStream containing the response body.
Throws:
HttpStatusCodeException - for exceptions which are the result of getting an unexpected HttpStatusCode in the response. These can be handled by the calling method or ignored as required by the situation.
See Also:
net.sf.sail.webapp.domain.webservice.http.HttpRestTransport#get(net.sf.sail.webapp.domain.webservice.http.HttpGetRequest)

post

public org.apache.commons.httpclient.methods.PostMethod post(HttpPostRequest httpPostRequestData)
                                                      throws HttpStatusCodeException
Description copied from interface: HttpRestTransport
Performs the POST operation given the data required for the post.

Specified by:
post in interface HttpRestTransport
Parameters:
httpPostRequestData - All the data required for this post request.
Returns:
A Map of response headers where the key is the header name and the value is the header value.
Throws:
HttpStatusCodeException - for exceptions which should be handled by the calling method.
See Also:
net.sf.sail.webapp.domain.webservice.http.HttpRestTransport#post(net.sf.sail.webapp.domain.webservice.http.HttpPostRequest)

put

public Map<String,String> put(HttpPutRequest httpPutRequestData)
                       throws HttpStatusCodeException
Description copied from interface: HttpRestTransport
Performs the PUT operation given the data required for the put.

Specified by:
put in interface HttpRestTransport
Parameters:
httpPutRequestData - All the data required for this put request
Returns:
A Map of response headers where the key is the header name and the value is the header value.
Throws:
HttpStatusCodeException - for exceptions which should be handled by the calling method.
See Also:
net.sf.sail.webapp.domain.webservice.http.HttpRestTransport#put(net.sf.sail.webapp.domain.webservice.http.HttpPutRequest)


Copyright © 2012. All Rights Reserved.