public final class NetTools extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NetTools.HttpInputStream |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendRootRelativeURL(Appendable a,
javax.servlet.http.HttpServletRequest req,
String rurl)
Constructs an URL that is relative to the root of the server from an
application-root based URL.
|
static String |
getApplicationContext(javax.servlet.http.HttpServletRequest req)
This returns the application's context path without any slashes!!.
|
static String |
getApplicationURL(javax.servlet.http.HttpServletRequest req)
Returns the URL to the root of the application.
|
static String |
getHostName(javax.servlet.http.HttpServletRequest req) |
static int |
getHostPort(javax.servlet.http.HttpServletRequest req) |
static String |
getHostURL(javax.servlet.http.HttpServletRequest req) |
static void |
getHostURL(StringBuffer sb,
javax.servlet.http.HttpServletRequest req)
Takes the host= parameter in the header to construct the real
hostname.
|
static String |
getInputPath(javax.servlet.http.HttpServletRequest req)
Takes an input request and returns a proper relative path for
the request.
|
static String |
getRootRelativeURL(javax.servlet.http.HttpServletRequest req,
String rurl) |
static HttpCallException |
handleHttpError(String url,
HttpURLConnection huc) |
static InputStream |
httpGetStream(String url,
int timeout)
Calls an external server and returns the response as an inputstream.
|
static String |
httpGetString(String url,
int timeout)
Calls an external server and returns the response as a string.
|
static Document |
httpGetXMLDocument(String url,
int timeout,
boolean namespaceaware)
Calls an external server and tries to retrieve an XML formatted document
from it.
|
public static void getHostURL(StringBuffer sb, javax.servlet.http.HttpServletRequest req)
sb - req - Exceptionpublic static String getHostURL(javax.servlet.http.HttpServletRequest req)
public static String getHostName(javax.servlet.http.HttpServletRequest req)
public static int getHostPort(javax.servlet.http.HttpServletRequest req)
public static String getInputPath(javax.servlet.http.HttpServletRequest req)
req - @Nonnull public static String getApplicationURL(@Nonnull javax.servlet.http.HttpServletRequest req)
req - public static String getApplicationContext(javax.servlet.http.HttpServletRequest req)
req - public static void appendRootRelativeURL(Appendable a, javax.servlet.http.HttpServletRequest req, String rurl) throws IOException
a - IOException - Nonsense exception needed by stupid Java checked exception crappublic static String getRootRelativeURL(javax.servlet.http.HttpServletRequest req, String rurl)
public static Document httpGetXMLDocument(String url, int timeout, boolean namespaceaware) throws Exception
Exceptionpublic static InputStream httpGetStream(String url, int timeout) throws Exception
url - Exceptionpublic static String httpGetString(String url, int timeout) throws Exception
url - Exceptionpublic static HttpCallException handleHttpError(String url, HttpURLConnection huc) throws Exception
ExceptionCopyright © 2017 etc.to. All rights reserved.