|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.util.URLHelper
Utility class to manipulate URL's and provide some additional capability for using them.
| Field Summary | |
static String |
DEFAULT_PAGE
This is the default value for the initial page of the application |
static String |
PROTOCOL_CLASSPATH
This contains the name of the URL protocol that implies the resouce can be located in the classpath |
static String |
PROTOCOL_WEBROOT
This contains the name of the URL protocol that implies the resource can be found relative to the location of the web-root on the local file system, This assumes that you are running this inside a servlet, on a web server |
| Constructor Summary | |
URLHelper()
|
|
| Method Summary | |
static String |
buildUrl(String url,
HttpServletRequest req)
Build up a valid URL string based on the supplied source URL string. |
static String |
getBase(HttpServletRequest request)
Based on a HttpRequest, this routine will ingure out the URL that represents the root of the web application. |
static String |
getFullUrl(HttpServletRequest request)
Get a complete string based representation of a request's source URL include query parameters |
static InputStream |
getInputStream(String resourceName)
This method will try to load the input resource off the classpath. |
static URL |
getUrl(String resourceName)
Deprecated. Use the newExtendedURL() method. |
static void |
main(String[] args)
Test rig |
static URL |
newExtendedURL(String url)
Create a URL object from a string, this can handle the two new Custom URL protocols, 'classpath:///' and 'webroot:///'. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String PROTOCOL_CLASSPATH
public static final String PROTOCOL_WEBROOT
public static final String DEFAULT_PAGE
| Constructor Detail |
public URLHelper()
| Method Detail |
public static String getBase(HttpServletRequest request)
request - A HttpRequest used to derive information about the root of the web applicatoin
public static String buildUrl(String url,
HttpServletRequest req)
url - The URL to build and validatereq - The httpRequest needed to derive the web app base
public static String getFullUrl(HttpServletRequest request)
request - HttpRequest containing the url to extracts
public static InputStream getInputStream(String resourceName)
throws IOException
resourceName - the resource to be located.
IOException - if any error occurs while opening the stream.public static URL getUrl(String resourceName)
resourceName - the resource to be located.
public static URL newExtendedURL(String url)
throws MalformedURLException
url - source URL that may use one of the new protocols
MalformedURLException - if the supplied URL is not valid, or can't be translated into something that is validpublic static void main(String[] args)
args - none required
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||