to.etc.domui.server.parts
Class InternalResourcePart
java.lang.Object
to.etc.domui.server.parts.InternalResourcePart
- All Implemented Interfaces:
- IBufferedPartFactory, IPartFactory
public class InternalResourcePart
- extends java.lang.Object
- implements IBufferedPartFactory
This part handler handles all internal resource requests; this are requests where the URL starts
with a dollar sign (and the URL is not some well-known name). The reason for this code is to allow
resources to come from the classpath and not just from within a webapp's files. This
code serves most of the default DomUI browser resources.
Resources are located as follows:
- The dollar is stripped from the start of the base URL
- Try to find the resulting name in the webapp data files (below WebContent). If found there return this resource as a cached stream.
- Try to find the name as a Java classpath resource below /resources/, and return it as a cached stream.
- Author:
- Frits Jalvingh
Created on Nov 11, 2009
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InternalResourcePart
public InternalResourcePart()
decodeKey
public java.lang.Object decodeKey(java.lang.String rurl,
IExtendedParameterInfo param)
throws java.lang.Exception
- Description copied from interface:
IBufferedPartFactory
- Decode the input and create a KEY for the request. This key must be hashable, and forms
the key for the cache to retrieve an already generated copy.
- Specified by:
decodeKey
in interface IBufferedPartFactory
- Returns:
-
- Throws:
java.lang.Exception
generate
public void generate(@Nonnull
PartResponse pr,
@Nonnull
DomApplication da,
@Nonnull
java.lang.Object inkey,
@Nonnull
IResourceDependencyList rdl)
throws java.lang.Exception
- Generate the local resource. This first checks to see if the resource is "externalized" into the webapp's
files; if so we use the copy from there. Otherwise we expect the file to reside as a class resource rooted
by the /resources path in the classpath.
Resources are usually returned with an Expires: header allowing the browser to cache the resources for up to
a week. However, to allow for easy debugging, you can disable all expiry header generation using a developer
flag in $HOME/.developer.properties: domui.expires=false. In addition, resources generated from the webapp do
not get an expires header when the server runs in DEBUG mode.
- Specified by:
generate
in interface IBufferedPartFactory
da
- The Application on behalf of which this resource is generated.inkey
- The key, as specified by decodeKey.rdl
- When running in development mode, each file resource used should be added
to this list. The buffer code will use that list to check whether a source
for this thing has changed; if so it will be re-generated. This causes runtime
editability for parameter files of any buffered thingydoo.
- Throws:
java.lang.Exception
- See Also:
to.etc.domui.server.parts.IBufferedPartFactory#generate(to.etc.domui.server.parts.PartResponse, to.etc.domui.server.DomApplication, java.lang.Object, to.etc.domui.util.resources.ResourceDependencyList)