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
A class to handle all href related actions in an XFA based form.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHrefService(Node contextNode, int nHrefCacheSize) Instantiates a newHrefServiceusing a specifiedcontextNodeas the context for resolving relative references.HrefService(String sConfigSchemaName, int nHrefCacheSize) Instantiates a newHrefServiceusing the configuration to determine the node that will service as the context for resolving relative references. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidClears the cache.final StringGets the alternate URL that relative hrefs will be resolved against.final StringGets the base URL that relative hrefs will be resolved against.final intGets the size of the cache in bytes.final StringGets the configuration schema name associated with this service.final NodeGets the context node associated with this service.final intGets the current size of the cache in bytes.getDocument(AppModel appModel) Gets theTemplateModelassociated with the givenAppModel.final booleanGet the trustiness of absolute URLs.final voidisTrusted(boolean bTrusted) Sets the trustiness of absolute urls.loadFragment(AppModel appModel, String sUrl) Resolves a URL and loads the reference XFA document into a newAppModel.loadFragment(ProtoableNode protoableNode) Resolves theusehrefattribute in the givenProtoableNodeand loads the referenced document into a newAppModel.final voidsetAlternativeUrl(String sAltUrl) Sets the alternate URL that relative hrefs will be resolved against.final voidsetBaseUrl(String sBaseUrl) Sets the base URL that relative hrefs will be resolved against.final voidsetContextNode(Node contextNode) Sets the context node associated with this service.
-
Field Details
-
CACHE_SIZE
public static final int CACHE_SIZEThe default cache size, in bytes.- See Also:
-
-
Constructor Details
-
HrefService
Instantiates a newHrefServiceusing a specifiedcontextNodeas 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_SIZEis used.
-
HrefService
Instantiates a newHrefServiceusing 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.baseandtemplate.urielements 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_SIZEis used.
-
-
Method Details
-
getContextNode
Gets the context node associated with this service.- Returns:
- the context node associated with this service.
-
getConfigSchemaName
Gets the configuration schema name associated with this service.- Returns:
- the configuration schema name associated with this service.
-
setContextNode
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
Resolves theusehrefattribute in the givenProtoableNodeand loads the referenced document into a newAppModel. Any fragment identifier in the URL is ignored.- Specified by:
loadFragmentin interfaceHrefHandler- Parameters:
protoableNode- aProtoableNodewith ausehrefattribute.- Returns:
- the newly created
AppModelcontaining the document loaded from the referenced location, ornullupon error.
-
loadFragment
Resolves a URL and loads the reference XFA document into a newAppModel. Any fragment identifier in the URL is ignored.- Specified by:
loadFragmentin interfaceHrefHandler- Parameters:
appModel- theAppModelcontaining the URLsUrl- the URL that references the external XFA document- Returns:
- the newly created
AppModelcontaining the document loaded from the referenced location.
-
getDocument
Gets theTemplateModelassociated with the givenAppModel.- Specified by:
getDocumentin interfaceHrefHandler- Parameters:
appModel- anAppModel- Returns:
- the
TemplateModelfromappModelornullif there is noTemplateModel.
-
getBaseUrl
Gets the base URL that relative hrefs will be resolved against.- Returns:
- a URL to resolve relative hrefs against.
-
setBaseUrl
Sets the base URL that relative hrefs will be resolved against.- Parameters:
sBaseUrl- a URL to resolve relative hrefs against.
-
getAlternativeUrl
Gets the alternate URL that relative hrefs will be resolved against.- Returns:
- a URL to resolve relative hrefs against.
-
setAlternativeUrl
Sets the alternate URL that relative hrefs will be resolved against.- Parameters:
sAltUrl- a URL to resolve relative hrefs against.
-