|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dmonix.net.NetUtil
Class with net related utility methods.
Copyright: Copyright (c) 2004
Company: dmonix.org
| Field Summary | |
static java.lang.String |
CONTENT_TYPE_PLAIN
Content type plain set in the HTTP header. |
static java.lang.String |
CONTENT_TYPE_XML
Content type XML set in the HTTP header. |
static java.lang.String |
ENCODING_ISO_8859_1
ISO Latin Alphabet No. 1, a.k.a. |
static java.lang.String |
ENCODING_US_ASCII
Seven-bit ASCII, a.k.a. |
static java.lang.String |
ENCODING_UTF_16
Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark. |
static java.lang.String |
ENCODING_UTF_16BE
Sixteen-bit UCS Transformation Format, big-endian byte order. |
static java.lang.String |
ENCODING_UTF_16LE
Sixteen-bit UCS Transformation Format, little-endian byte order. |
static java.lang.String |
ENCODING_UTF_8
Eight-bit UCS Transformation Format. |
| Constructor Summary | |
NetUtil()
|
|
| Method Summary | |
static java.lang.String |
getExternalIPAddress()
The method returns the IP-address as seen by servers/clients outside the local LAN. |
static java.util.Date |
getModifiedDate(java.net.URL url)
Returns the date of the last modification for the remote file. |
static void |
resetProxy()
Resets/removes the system parameters for the proxy host. |
static void |
resetSocketTimeout()
Resets/removes the socket timeout. |
static java.lang.String |
sendHTTPGetRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
Send a HTTP get request. |
static java.lang.String |
sendHTTPGetRequest(java.lang.String address,
java.lang.String file)
Send a HTTP get request. |
static java.lang.String |
sendHTTPPostRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
Send a HTTP post request. |
static java.lang.String |
sendHTTPPostRequest(java.lang.String address,
java.lang.String file)
Send a HTTP post request. |
static java.lang.String |
sendHTTPSGetRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
Send a HTTPS get request. |
static java.lang.String |
sendHTTPSGetRequest(java.lang.String address,
java.lang.String file)
Send a HTTPS get request. |
static java.lang.String |
sendHTTPSPostRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
Send a HTTPS post request. |
static java.lang.String |
sendHTTPSPostRequest(java.lang.String address,
java.lang.String file)
Send a HTTPS post request. |
static void |
setProxy(java.lang.String proxyHost,
java.lang.String proxyPort)
Sets the system parameters used to determine the proxy. |
void |
setSocketTimeout(java.lang.String timeout)
Sets the socket timeout. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String CONTENT_TYPE_PLAIN
public static final java.lang.String CONTENT_TYPE_XML
public static final java.lang.String ENCODING_US_ASCII
public static final java.lang.String ENCODING_ISO_8859_1
public static final java.lang.String ENCODING_UTF_8
public static final java.lang.String ENCODING_UTF_16BE
public static final java.lang.String ENCODING_UTF_16LE
public static final java.lang.String ENCODING_UTF_16
| Constructor Detail |
public NetUtil()
| Method Detail |
public static java.lang.String getExternalIPAddress()
throws java.io.IOException,
java.net.MalformedURLException
http://www.dmonix.org/getIP.jsp to find out the
IP-address.
java.io.IOException
java.net.MalformedURLException
public static java.util.Date getModifiedDate(java.net.URL url)
throws java.io.IOException
HTTP HEAD request and read the Last-Modified
parameter in the answer.
url - The URL of the file
java.io.IOException
public static void setProxy(java.lang.String proxyHost,
java.lang.String proxyPort)
proxyHost - The hostproxyPort - The portpublic static void resetProxy()
public void setSocketTimeout(java.lang.String timeout)
timeout - socket timeout in millispublic static void resetSocketTimeout()
public static java.lang.String sendHTTPGetRequest(java.lang.String address,
java.lang.String file)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressfile - The remote file
java.io.IOException
java.net.MalformedURLException
public static java.lang.String sendHTTPGetRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressport - The remote portfile - The remote filecontentType - content typerequestString - The string to send
java.io.IOException
java.net.MalformedURLExceptionCONTENT_TYPE_PLAIN,
CONTENT_TYPE_XML
public static java.lang.String sendHTTPPostRequest(java.lang.String address,
java.lang.String file)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressfile - The remote file
java.io.IOException
java.net.MalformedURLException
public static java.lang.String sendHTTPPostRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressport - The remote portfile - The remote filecontentType - content typerequestString - The string to send
java.io.IOException
java.net.MalformedURLExceptionCONTENT_TYPE_PLAIN,
CONTENT_TYPE_XML
public static java.lang.String sendHTTPSGetRequest(java.lang.String address,
java.lang.String file)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressfile - The remote file
java.io.IOException
java.net.MalformedURLException
public static java.lang.String sendHTTPSGetRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressport - The remote portfile - The remote filecontentType - content typerequestString - The string to send
java.io.IOException
java.net.MalformedURLExceptionCONTENT_TYPE_PLAIN,
CONTENT_TYPE_XML
public static java.lang.String sendHTTPSPostRequest(java.lang.String address,
java.lang.String file)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressfile - The remote file
java.io.IOException
java.net.MalformedURLException
public static java.lang.String sendHTTPSPostRequest(java.lang.String address,
int port,
java.lang.String file,
java.lang.String contentType,
java.lang.String requestString)
throws java.io.IOException,
java.net.MalformedURLException
address - The remote addressport - The remote portfile - The remote filecontentType - content typerequestString - The string to send
java.io.IOException
java.net.MalformedURLExceptionCONTENT_TYPE_PLAIN,
CONTENT_TYPE_XML
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||