Package com.inductiveautomation.snap.web
Class WebURL
- java.lang.Object
- 
- com.inductiveautomation.snap.web.WebURL
 
- 
 public class WebURL extends java.lang.ObjectA class to represent a URL for a WebSite and WebFile (it can be both for nested sources). Has the form: [Scheme:][//Authority][/Path[!/Path]][?Query][#HashTag]. Authority has the form: [UserInfo@]Host[:Port]. WebURL is a thin wrapper around standard URL, but provides easy access to the WebSite and WebFile.
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedWebURL(java.lang.String aSpec)Creates a new WebURL for given URL string.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WebFilecreateFile(boolean isDir)Creates a file for the URL.booleanequals(java.lang.Object anObj)Standard equals implementation.WebSitegetAsSite()WebFilegetFile()Returns the file for the URL, may be null.protected WebFilegetFileImpl()WebURLgetFileURL()Returns the URL for the file (no hashtags).java.lang.StringgetHost()Returns the Host part of the URL (the Authority minus the optional UserInfo and Port).java.lang.StringgetPath()Returns the part of the URL string that describes the file path.java.lang.StringgetPathName()Returns the last component of the file path.java.lang.StringgetPathNameSimple()intgetPort()Returns the port of the URL.java.lang.StringgetQuery()Returns the part of the URL string that describes the query.java.lang.StringgetQueryValue(java.lang.String aKey)Returns the value for given Query key in URL, if available.java.lang.StringgetRef()Returns the hash tag reference from the URL as a simple string.java.lang.StringgetRefValue(java.lang.String aKey)Returns the value for given HashTag key in URL, if available.java.lang.StringgetScheme()Returns the URL Scheme (lower case).WebSitegetSite()WebURLgetSiteURL()Returns the URL for the source of this URL.WebURLgetStaticFileURL()java.lang.StringgetString()java.net.URLgetURL()Returns the standard URL.static WebURLgetURL(java.lang.Class aClass, java.lang.String aName)Returns a URL for given class and resource name.static WebURLgetURL(java.lang.Object anObj)Returns a URL for given object.inthashCode()Standard HashCode implementation.booleanisFileSet()Returns whether file has been set/loaded for this URL.booleanisFileURL()Returns whether URL is for file only (no hashtags).booleanisStaticFileURL()Returns whether URL is for static file only (no query/hashtags).java.lang.StringtoString()Standard toString implementation.
 
- 
- 
- 
Method Detail- 
getURL@Nullable public static WebURL getURL(@Nullable java.lang.Object anObj) Returns a URL for given object.- Parameters:
- anObj- Object to create a WebURL from. May be null (if null, null is returned.)
- Returns:
- a WebURL if one could be created, otherwise null.
 
 - 
getURL@Nullable public static WebURL getURL(@Nonnull java.lang.Class aClass, @Nullable java.lang.String aName) Returns a URL for given class and resource name.
 - 
getURLpublic java.net.URL getURL() Returns the standard URL.
 - 
getString@Nonnull public java.lang.String getString() - Returns:
- Returns the URL string, not null
 
 - 
getScheme@Nullable public java.lang.String getScheme() Returns the URL Scheme (lower case).
 - 
getHost@Nullable public java.lang.String getHost() Returns the Host part of the URL (the Authority minus the optional UserInfo and Port).
 - 
getPortpublic int getPort() Returns the port of the URL.
 - 
getPath@Nullable public java.lang.String getPath() Returns the part of the URL string that describes the file path.
 - 
getPathNamepublic java.lang.String getPathName() Returns the last component of the file path. Not null.
 - 
getPathNameSimplepublic java.lang.String getPathNameSimple() - Returns:
- Returns the last component of the file path minus any '.' extension suffix, not null
 
 - 
getQuery@Nullable public java.lang.String getQuery() Returns the part of the URL string that describes the query.
 - 
getQueryValue@Nullable public java.lang.String getQueryValue(@Nonnull java.lang.String aKey)Returns the value for given Query key in URL, if available.
 - 
getRef@Nullable public java.lang.String getRef() Returns the hash tag reference from the URL as a simple string.
 - 
getRefValue@Nullable public java.lang.String getRefValue(@Nonnull java.lang.String aKey)Returns the value for given HashTag key in URL, if available.
 - 
getSite@Nonnull public WebSite getSite() - Returns:
- Returns the source of this URL, not null.
 
 - 
getSiteURL@Nonnull public WebURL getSiteURL() Returns the URL for the source of this URL.
 - 
isFileSetpublic boolean isFileSet() Returns whether file has been set/loaded for this URL.
 - 
getFile@Nullable public WebFile getFile() Returns the file for the URL, may be null.
 - 
getFileImpl@Nullable protected WebFile getFileImpl() - Returns:
- Returns the file for the URL, may be null.
 
 - 
createFile@Nullable public WebFile createFile(boolean isDir) Creates a file for the URL.
 - 
isFileURLpublic boolean isFileURL() Returns whether URL is for file only (no hashtags).
 - 
isStaticFileURLpublic boolean isStaticFileURL() Returns whether URL is for static file only (no query/hashtags).
 - 
getFileURL@Nonnull public WebURL getFileURL() Returns the URL for the file (no hashtags).
 - 
getStaticFileURLpublic WebURL getStaticFileURL() - Returns:
- Returns the URL for the static file (no query/hashtags), not null.
 
 - 
getAsSite@Nonnull public WebSite getAsSite() - Returns:
- Returns the site for the URL, not null
 
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() Standard HashCode implementation.- Overrides:
- hashCodein class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() Standard toString implementation. Not null.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-