Class UrlResource
- java.lang.Object
- 
- org.apache.tapestry5.internal.util.VirtualResource
- 
- org.apache.tapestry5.internal.services.UrlResource
 
 
- 
- All Implemented Interfaces:
- Resource
 
 public class UrlResource extends VirtualResource 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.net.URLPLACEHOLDER_URL- 
Fields inherited from class org.apache.tapestry5.internal.util.VirtualResourceUTF8
 
- 
 - 
Constructor SummaryConstructors Constructor Description UrlResource()UrlResource(java.net.URL url)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()Returns true if the resource exists; if a stream to the content of the file may be opened.ResourceforLocale(java.util.Locale locale)Returns a localized version of the resource.java.io.InputStreamopenStream()Opens a stream to the content of the resource, or returns null if the resource does not exist.java.lang.StringtoString()java.net.URLtoURL()Returns the URL for the resource, or null if it does not exist.- 
Methods inherited from class org.apache.tapestry5.internal.util.VirtualResourceforFile, getFile, getFolder, getPath, isVirtual, toInputStream, toInputStream, withExtension
 
- 
 
- 
- 
- 
Field Detail- 
PLACEHOLDER_URLpublic static final java.net.URL PLACEHOLDER_URL 
 
- 
 - 
Constructor Detail- 
UrlResourcepublic UrlResource() 
 - 
UrlResourcepublic UrlResource(java.net.URL url) 
 
- 
 - 
Method Detail- 
openStreampublic java.io.InputStream openStream() throws java.io.IOException Description copied from interface:ResourceOpens a stream to the content of the resource, or returns null if the resource does not exist. The native input stream supplied by the resource is wrapped in aBufferedInputStream.- Returns:
- an open, buffered stream to the content, if available
- Throws:
- java.io.IOException
 
 - 
toURLpublic java.net.URL toURL() Description copied from interface:ResourceReturns the URL for the resource, or null if it does not exist. This value is lazily computed; starting in 5.3.4, subclasses may cache the result. Starting in 5.4, some "virtual resources" may return null.- Specified by:
- toURLin interface- Resource
- Overrides:
- toURLin class- VirtualResource
 
 - 
existspublic boolean exists() Description copied from interface:ResourceReturns true if the resource exists; if a stream to the content of the file may be opened. A resource exists ifResource.toURL()returns a non-null value. Starting in release 5.3.4, the result of this is cached. Starting in 5.4, some "virtual resources", may return true even thoughResource.toURL()returns null.- Specified by:
- existsin interface- Resource
- Overrides:
- existsin class- VirtualResource
- Returns:
- true if the resource exists, false if it does not
 
 - 
forLocalepublic Resource forLocale(java.util.Locale locale) Description copied from interface:ResourceReturns a localized version of the resource. May return null if no such resource exists. Starting in release 5.3.4, the result of this method is cached internally.- Specified by:
- forLocalein interface- Resource
- Overrides:
- forLocalein class- VirtualResource
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-