org.gcube.contentmanagement.util.remotefile.protocols.url.http
Class HTTPCommunicator

java.lang.Object
  extended by org.gcube.contentmanagement.util.remotefile.protocols.url.http.HTTPCommunicator

public class HTTPCommunicator
extends java.lang.Object

The Class HTTPCommunicator.


Nested Class Summary
static class HTTPCommunicator.HTTPHeader
          The Class HTTPHeader.
 
Constructor Summary
HTTPCommunicator()
           
 
Method Summary
static java.util.HashMap<java.lang.String,java.lang.String> decodeParameters(java.lang.String parameters)
          parses a x-www-form-urlencoded string and returns a set f key/value pairs.
static java.util.HashMap<java.lang.String,java.lang.String> extractParameters(java.lang.String urlAndParameters)
          Extract parameters.
static void GET(java.net.URL url, java.io.File f)
          Gets the.
static void GET(java.net.URL url, java.io.File f, long start, long end)
          Gets the.
static HTTPCommunicator.HTTPHeader getHeader(java.net.URL url)
          Gets the value of field header.
static void main(java.lang.String[] Args)
          Test main.
static void POST(java.net.URL url, java.io.File f)
          POST.
static void POST(java.net.URL url, java.io.File f, long start, long end)
          POST.
static boolean resourceExist(java.net.URL url)
          Resource exist.
static void retrieve(java.net.URL url, java.io.File f)
          Retrieve.
static void retrieveChunk(java.net.URL url, java.io.File f, long start, long end)
          Retrieve chunk.
static void retrieveMultithreaded(java.net.URL url, java.io.File f, long length)
          Retrieve multithreaded.
static void retrieveSingleThreaded(java.net.URL url, java.io.File f)
          Retrieve single threaded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPCommunicator

public HTTPCommunicator()
Method Detail

extractParameters

public static java.util.HashMap<java.lang.String,java.lang.String> extractParameters(java.lang.String urlAndParameters)
                                                                              throws java.io.UnsupportedEncodingException
Extract parameters.

Parameters:
urlAndParameters - the url and parameters
Returns:
the hash map< string, string>
Throws:
java.io.UnsupportedEncodingException - the unsupported encoding exception

decodeParameters

public static java.util.HashMap<java.lang.String,java.lang.String> decodeParameters(java.lang.String parameters)
                                                                             throws java.io.UnsupportedEncodingException
parses a x-www-form-urlencoded string and returns a set f key/value pairs.

Parameters:
parameters - the parameters
Returns:
the hash map< string, string>
Throws:
java.io.UnsupportedEncodingException - the unsupported encoding exception

resourceExist

public static boolean resourceExist(java.net.URL url)
Resource exist.

Parameters:
url - the url
Returns:
true, if successful

getHeader

public static HTTPCommunicator.HTTPHeader getHeader(java.net.URL url)
                                             throws java.io.IOException
Gets the value of field header.

Parameters:
url - the url
Returns:
the value of field header
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

retrieve

public static void retrieve(java.net.URL url,
                            java.io.File f)
                     throws java.io.IOException
Retrieve.

Parameters:
url - the url
f - the f
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

retrieveSingleThreaded

public static void retrieveSingleThreaded(java.net.URL url,
                                          java.io.File f)
                                   throws java.io.IOException
Retrieve single threaded.

Parameters:
url - the url
f - the f
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

retrieveMultithreaded

public static void retrieveMultithreaded(java.net.URL url,
                                         java.io.File f,
                                         long length)
                                  throws java.io.IOException
Retrieve multithreaded.

Parameters:
url - the url
f - the f
length - the length
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

retrieveChunk

public static void retrieveChunk(java.net.URL url,
                                 java.io.File f,
                                 long start,
                                 long end)
                          throws java.io.IOException
Retrieve chunk.

Parameters:
url - the url
f - the f
start - the start
end - the end
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

GET

public static void GET(java.net.URL url,
                       java.io.File f)
                throws java.io.IOException
Gets the.

Parameters:
url - the url
f - the f
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

GET

public static void GET(java.net.URL url,
                       java.io.File f,
                       long start,
                       long end)
                throws java.io.IOException
Gets the.

Parameters:
url - the url
f - the f
start - the start
end - the end
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

POST

public static void POST(java.net.URL url,
                        java.io.File f)
                 throws java.io.IOException
POST.

Parameters:
url - the url
f - the f
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

POST

public static void POST(java.net.URL url,
                        java.io.File f,
                        long start,
                        long end)
                 throws java.io.IOException
POST.

Parameters:
url - the url
f - the f
start - the start
end - the end
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

main

public static void main(java.lang.String[] Args)
                 throws java.lang.Exception
Test main.

Parameters:
Args - the args
Throws:
java.lang.Exception - the exception