cn.com.believer.songyuanframework.openapi.storage.box.impl.simple.core
Class BoxHTTPManager

java.lang.Object
  extended by cn.com.believer.songyuanframework.openapi.storage.box.impl.simple.core.BoxHTTPManager

public final class BoxHTTPManager
extends java.lang.Object

Author:
Jimmy

Field Summary
protected static Logger LOGGER
          log4j object.
 
Method Summary
 Document doGet(java.lang.String url)
          http get method, get a XML result.
 byte[] doGetByteArry(java.lang.String url)
          post to server and get byte array.
 java.io.File doGetFile(java.lang.String url, java.io.File inFile)
          download as a file object.
 java.lang.String doMultipartPost(java.lang.String url, java.util.List fileList)
          upload multiple files.
 java.lang.String doMultipartPost(java.lang.String url, java.util.Map filesHashMap)
          upload multiple files.
 java.lang.String doPost(java.lang.String url, java.lang.String postData)
          post data to gateway.
 java.lang.String doPostXML(java.lang.String url, java.lang.String postData)
          post XML content to the server.
static BoxHTTPManager getBoxHTTPManager()
          get the only one manager.
 java.util.Properties getConfig()
           
 HttpClient getHttpClient()
          get the only http client instance of system, config it as what you want.
 void setConfig(java.util.Properties config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER
log4j object.

Method Detail

getConfig

public java.util.Properties getConfig()
Returns:
the config

setConfig

public void setConfig(java.util.Properties config)
Parameters:
config - the config to set

getBoxHTTPManager

public static BoxHTTPManager getBoxHTTPManager()
get the only one manager.

Returns:
XDriveHTTPManager

doPost

public java.lang.String doPost(java.lang.String url,
                               java.lang.String postData)
                        throws java.io.IOException
post data to gateway.

Parameters:
url - http URL
postData - string of json
Returns:
string response
Throws:
java.io.IOException - IOException

doPostXML

public java.lang.String doPostXML(java.lang.String url,
                                  java.lang.String postData)
                           throws java.io.IOException
post XML content to the server.

Parameters:
url - server URL
postData - XML string
Returns:
result from server
Throws:
java.io.IOException - IO exception

doGet

public Document doGet(java.lang.String url)
               throws java.io.IOException,
                      DocumentException
http get method, get a XML result.

Parameters:
url - http URL
Returns:
XML result
Throws:
java.io.IOException - io exception
DocumentException - document exception

doGetByteArry

public byte[] doGetByteArry(java.lang.String url)
                     throws java.io.IOException
post to server and get byte array.

Parameters:
url - server URL
Returns:
byte array.
Throws:
java.io.IOException - IO exception

doGetFile

public java.io.File doGetFile(java.lang.String url,
                              java.io.File inFile)
                       throws java.io.IOException
download as a file object.

Parameters:
url - server URL
inFile - input file object
Returns:
output file object
Throws:
java.io.IOException - IO exception

doMultipartPost

public java.lang.String doMultipartPost(java.lang.String url,
                                        java.util.Map filesHashMap)
                                 throws java.io.IOException
upload multiple files.

Parameters:
url - http URL
filesHashMap - hashmap, key is string(file name), value is byte array.
Returns:
response
Throws:
java.io.IOException - exception

doMultipartPost

public java.lang.String doMultipartPost(java.lang.String url,
                                        java.util.List fileList)
                                 throws java.io.IOException
upload multiple files.

Parameters:
url - http URL
fileList - file list(File list)
Returns:
response
Throws:
java.io.IOException - exception

getHttpClient

public HttpClient getHttpClient()
get the only http client instance of system, config it as what you want.

Returns:
the hc