Package com.adobe.xfa.service.href
Class HrefService
- java.lang.Object
-
- com.adobe.xfa.service.Service
-
- com.adobe.xfa.service.href.HrefService
-
- All Implemented Interfaces:
HrefHandler
public class HrefService extends Service implements HrefHandler
A class to handle all href related actions in an XFA based form.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CACHE_SIZE
The default cache size, in bytes.
-
Constructor Summary
Constructors Constructor Description HrefService(Node contextNode, int nHrefCacheSize)
Instantiates a newHrefService
using a specifiedcontextNode
as the context for resolving relative references.HrefService(java.lang.String sConfigSchemaName, int nHrefCacheSize)
Instantiates a newHrefService
using the configuration to determine the node that will service as the context for resolving relative references.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
Clears the cache.java.lang.String
getAlternativeUrl()
Gets the alternate URL that relative hrefs will be resolved against.java.lang.String
getBaseUrl()
Gets the base URL that relative hrefs will be resolved against.int
getCacheSize()
Gets the size of the cache in bytes.java.lang.String
getConfigSchemaName()
Gets the configuration schema name associated with this service.Node
getContextNode()
Gets the context node associated with this service.int
getCurrentCacheSize()
Gets the current size of the cache in bytes.Model
getDocument(AppModel appModel)
Gets theTemplateModel
associated with the givenAppModel
.boolean
isTrusted()
Get the trustiness of absolute URLs.void
isTrusted(boolean bTrusted)
Sets the trustiness of absolute urls.AppModel
loadFragment(AppModel appModel, java.lang.String sUrl)
Resolves a URL and loads the reference XFA document into a newAppModel
.AppModel
loadFragment(ProtoableNode protoableNode)
Resolves theusehref
attribute in the givenProtoableNode
and loads the referenced document into a newAppModel
.void
setAlternativeUrl(java.lang.String sAltUrl)
Sets the alternate URL that relative hrefs will be resolved against.void
setBaseUrl(java.lang.String sBaseUrl)
Sets the base URL that relative hrefs will be resolved against.void
setContextNode(Node contextNode)
Sets the context node associated with this service.
-
-
-
Field Detail
-
CACHE_SIZE
public static final int CACHE_SIZE
The default cache size, in bytes.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HrefService
public HrefService(Node contextNode, int nHrefCacheSize)
Instantiates a newHrefService
using a specifiedcontextNode
as the context for resolving relative references.- Parameters:
contextNode
- the context node for resolving relative references.nHrefCacheSize
- the maximum size of the cache of URL bytes. If negative, no caching is done. If zero,CACHE_SIZE
is used.
-
HrefService
public HrefService(java.lang.String sConfigSchemaName, int nHrefCacheSize)
Instantiates a newHrefService
using the configuration to determine the node that will service as the context for resolving relative references.- Parameters:
sConfigSchemaName
- the name of the configuration element containing thetemplate.base
andtemplate.uri
elements that describe how relative references are to be resolved.nHrefCacheSize
- the maximum size of the cache of URL bytes. If negative, no caching is done. If zero,CACHE_SIZE
is used.
-
-
Method Detail
-
getContextNode
public final Node getContextNode()
Gets the context node associated with this service.- Returns:
- the context node associated with this service.
-
getConfigSchemaName
public final java.lang.String getConfigSchemaName()
Gets the configuration schema name associated with this service.- Returns:
- the configuration schema name associated with this service.
-
setContextNode
public final void setContextNode(Node contextNode)
Sets the context node associated with this service.- Parameters:
contextNode
- the context node.
-
isTrusted
public final boolean isTrusted()
Get the trustiness of absolute URLs.- Returns:
- the trustiness. When
true
, absolute hrefs are allowed.
-
isTrusted
public final void isTrusted(boolean bTrusted)
Sets the trustiness of absolute urls. Trust implies that absolute hrefs are allowed.- Parameters:
bTrusted
- allow absolute URLs when true.
-
getCacheSize
public final int getCacheSize()
Gets the size of the cache in bytes.- Returns:
- the size of the cache in bytes.
-
clearCache
public final void clearCache()
Clears the cache. Removes all hrefs from the cache.
-
getCurrentCacheSize
public final int getCurrentCacheSize()
Gets the current size of the cache in bytes.- Returns:
- the current size of the cache in bytes.
-
loadFragment
public AppModel loadFragment(ProtoableNode protoableNode)
Resolves theusehref
attribute in the givenProtoableNode
and loads the referenced document into a newAppModel
. Any fragment identifier in the URL is ignored.- Specified by:
loadFragment
in interfaceHrefHandler
- Parameters:
protoableNode
- aProtoableNode
with ausehref
attribute.- Returns:
- the newly created
AppModel
containing the document loaded from the referenced location, ornull
upon error.
-
loadFragment
public AppModel loadFragment(AppModel appModel, java.lang.String sUrl)
Resolves a URL and loads the reference XFA document into a newAppModel
. Any fragment identifier in the URL is ignored.- Specified by:
loadFragment
in interfaceHrefHandler
- Parameters:
appModel
- theAppModel
containing the URLsUrl
- the URL that references the external XFA document- Returns:
- the newly created
AppModel
containing the document loaded from the referenced location.
-
getDocument
public Model getDocument(AppModel appModel)
Gets theTemplateModel
associated with the givenAppModel
.- Specified by:
getDocument
in interfaceHrefHandler
- Parameters:
appModel
- anAppModel
- Returns:
- the
TemplateModel
fromappModel
ornull
if there is noTemplateModel
.
-
getBaseUrl
public final java.lang.String getBaseUrl()
Gets the base URL that relative hrefs will be resolved against.- Returns:
- a URL to resolve relative hrefs against.
-
setBaseUrl
public final void setBaseUrl(java.lang.String sBaseUrl)
Sets the base URL that relative hrefs will be resolved against.- Parameters:
sBaseUrl
- a URL to resolve relative hrefs against.
-
getAlternativeUrl
public final java.lang.String getAlternativeUrl()
Gets the alternate URL that relative hrefs will be resolved against.- Returns:
- a URL to resolve relative hrefs against.
-
setAlternativeUrl
public final void setAlternativeUrl(java.lang.String sAltUrl)
Sets the alternate URL that relative hrefs will be resolved against.- Parameters:
sAltUrl
- a URL to resolve relative hrefs against.
-
-