com.google.code.facebookapi
Class DefaultCommunicationStrategy
java.lang.Object
com.google.code.facebookapi.DefaultCommunicationStrategy
- All Implemented Interfaces:
- CommunicationStrategy
public class DefaultCommunicationStrategy
- extends java.lang.Object
- implements CommunicationStrategy
CommunicationStrategy implementation that uses raw Java-API sockets.
|
Field Summary |
protected static java.lang.String |
CRLF
|
protected static org.apache.commons.logging.Log |
log
|
protected static java.lang.String |
PREF
|
protected static int |
UPLOAD_BUFFER_SIZE
|
|
Method Summary |
int |
getConnectionTimeout()
|
int |
getReadTimeout()
|
java.lang.String |
postRequest(java.net.URL serverUrl,
java.util.SortedMap<java.lang.String,java.lang.String> params)
Sends a post request to the specified URL. |
java.lang.String |
postRequest(java.net.URL serverUrl,
java.util.SortedMap<java.lang.String,java.lang.String> params,
java.lang.String fileName,
java.io.InputStream fileStream)
Helper function for posting a request that includes raw file data, such as file upload. |
void |
setConnectionTimeout(int connectionTimeout)
|
void |
setReadTimeout(int readTimeout)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
CRLF
protected static final java.lang.String CRLF
- See Also:
- Constant Field Values
PREF
protected static final java.lang.String PREF
- See Also:
- Constant Field Values
UPLOAD_BUFFER_SIZE
protected static final int UPLOAD_BUFFER_SIZE
- See Also:
- Constant Field Values
DefaultCommunicationStrategy
public DefaultCommunicationStrategy()
DefaultCommunicationStrategy
public DefaultCommunicationStrategy(int connectionTimeout,
int readTimeout)
getConnectionTimeout
public int getConnectionTimeout()
- Specified by:
getConnectionTimeout in interface CommunicationStrategy
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
- Specified by:
setConnectionTimeout in interface CommunicationStrategy
getReadTimeout
public int getReadTimeout()
- Specified by:
getReadTimeout in interface CommunicationStrategy
setReadTimeout
public void setReadTimeout(int readTimeout)
- Specified by:
setReadTimeout in interface CommunicationStrategy
postRequest
public java.lang.String postRequest(java.net.URL serverUrl,
java.util.SortedMap<java.lang.String,java.lang.String> params)
throws java.io.IOException
- Description copied from interface:
CommunicationStrategy
- Sends a post request to the specified URL.
- Specified by:
postRequest in interface CommunicationStrategy
- Parameters:
serverUrl - Target server URL.params - Parameters to include in POST body.
- Returns:
- String response.
- Throws:
java.io.IOException - Thrown on any communication-related error.
postRequest
public java.lang.String postRequest(java.net.URL serverUrl,
java.util.SortedMap<java.lang.String,java.lang.String> params,
java.lang.String fileName,
java.io.InputStream fileStream)
throws java.io.IOException
- Description copied from interface:
CommunicationStrategy
- Helper function for posting a request that includes raw file data, such as file upload.
- Specified by:
postRequest in interface CommunicationStrategy
- Parameters:
serverUrl - Target server URL.params - request parameters (not including the file)
- Returns:
- an InputStream with the request response
- Throws:
java.io.IOException
Copyright © 2010. All Rights Reserved.