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 intCACHE_SIZEThe default cache size, in bytes.
-
Constructor Summary
Constructors Constructor Description HrefService(Node contextNode, int nHrefCacheSize)Instantiates a newHrefServiceusing a specifiedcontextNodeas the context for resolving relative references.HrefService(java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Clears the cache.java.lang.StringgetAlternativeUrl()Gets the alternate URL that relative hrefs will be resolved against.java.lang.StringgetBaseUrl()Gets the base URL that relative hrefs will be resolved against.intgetCacheSize()Gets the size of the cache in bytes.java.lang.StringgetConfigSchemaName()Gets the configuration schema name associated with this service.NodegetContextNode()Gets the context node associated with this service.intgetCurrentCacheSize()Gets the current size of the cache in bytes.ModelgetDocument(AppModel appModel)Gets theTemplateModelassociated with the givenAppModel.booleanisTrusted()Get the trustiness of absolute URLs.voidisTrusted(boolean bTrusted)Sets the trustiness of absolute urls.AppModelloadFragment(AppModel appModel, java.lang.String sUrl)Resolves a URL and loads the reference XFA document into a newAppModel.AppModelloadFragment(ProtoableNode protoableNode)Resolves theusehrefattribute in the givenProtoableNodeand loads the referenced document into a newAppModel.voidsetAlternativeUrl(java.lang.String sAltUrl)Sets the alternate URL that relative hrefs will be resolved against.voidsetBaseUrl(java.lang.String sBaseUrl)Sets the base URL that relative hrefs will be resolved against.voidsetContextNode(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 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
public HrefService(java.lang.String sConfigSchemaName, int nHrefCacheSize)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 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 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
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:
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
public Model getDocument(AppModel appModel)
Gets theTemplateModelassociated with the givenAppModel.- Specified by:
getDocumentin interfaceHrefHandler- Parameters:
appModel- anAppModel- Returns:
- the
TemplateModelfromappModelornullif 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.
-
-