XFA4J

com.adobe.xfa.service.href
Class HrefService

java.lang.Object
  extended by com.adobe.xfa.service.Service
      extended by 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
static int CACHE_SIZE
          The default cache size, in bytes.
 
Constructor Summary
HrefService(Node contextNode, int nHrefCacheSize)
          Instantiates a new HrefService using a specified contextNode as the context for resolving relative references.
HrefService(java.lang.String sConfigSchemaName, int nHrefCacheSize)
          Instantiates a new HrefService using the configuration to determine the node that will service as the context for resolving relative references.
 
Method Summary
 java.lang.String getBaseUrl()
          Gets the base URL that relative hrefs will be resolved against.
 Model getDocument(AppModel appModel)
          Gets the TemplateModel associated with the given AppModel.
 AppModel loadFragment(AppModel appModel, java.lang.String sUrl)
          Resolves a URL and loads the reference XFA document into a new AppModel.
 AppModel loadFragment(ProtoableNode protoableNode)
          Resolves the usehref attribute in the given ProtoableNode and loads the referenced document into a new AppModel.
 void setBaseUrl(java.lang.String sBaseUrl)
          Sets the base URL that relative hrefs will be resolved against.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 new HrefService using a specified contextNode 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 new HrefService 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 the template.base and template.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

loadFragment

public AppModel loadFragment(ProtoableNode protoableNode)
Resolves the usehref attribute in the given ProtoableNode and loads the referenced document into a new AppModel. Any fragment identifier in the URL is ignored.

Specified by:
loadFragment in interface HrefHandler
Parameters:
protoableNode - a ProtoableNode with a usehref attribute.
Returns:
the newly created AppModel containing the document loaded from the referenced location, or null upon error.

loadFragment

public AppModel loadFragment(AppModel appModel,
                             java.lang.String sUrl)
Resolves a URL and loads the reference XFA document into a new AppModel. Any fragment identifier in the URL is ignored.

Specified by:
loadFragment in interface HrefHandler
Parameters:
appModel - the AppModel containing the URL
sUrl - 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 the TemplateModel associated with the given AppModel.

Specified by:
getDocument in interface HrefHandler
Parameters:
appModel - an AppModel
Returns:
the TemplateModel from appModel or null if there is no TemplateModel.

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.

XFA4J

© 2005 Adobe Systems Incorporated. All Rights Reserved.