uk.co.weft.domutil
Class JustFetchGenerator
java.lang.Object
uk.co.weft.domutil.DocumentGeneratorImpl
uk.co.weft.domutil.JustFetchGenerator
- All Implemented Interfaces:
- DocumentGenerator
- public class JustFetchGenerator
- extends DocumentGeneratorImpl
a JustFetchGenerator is not really a generator at all so much as a
proxy. It fetches a document from the network in real time and
parses it. This makes it easy to apply XSL transforms to arbitrary
documents out there in netland but there are some serious words of
caution which need to be given.
- This is computationally expensive.
- Do not use it for locally generated documents - the time
penalty will amaze you
- If at all possible use CachedPage
- You are placing a lot of trust in the quality of the
remote provider's XML. If it isn't valid, this will fail.
This class reads just one value from config,
source_url, which is, surprisingly, a string
representation of the sourc e URL from which the document should
be loaded.
- Version:
- $Revision: 1.6.4.1 $
This revision: $Author: simon $
$Log: JustFetchGenerator.java,v $
Revision 1.6.4.1 2005/12/23 10:48:33 simon
Brute force tidy up after CVS server crash: this time it should work.
Revision 1.6 2003/09/19 11:05:35 simon
Feature enhancement: accept source_url from generate time context, over-riding that set in the config.
Revision 1.5 2003/08/20 09:38:35 simon
Code cleanup with eclipse; mostly removal of exccessive includes
Revision 1.4 2002/03/08 10:53:43 simon
Removed all remaining explicit references to xerces, except as the default
in DOMStub. All other classes now get parsers as needed from DOMStub.
Revision 1.3 2002/01/17 15:26:09 simon
Document generation now working using pure org.w3.dom API.
Revision 1.2 2001/04/23 10:12:43 simon
Problem identified in JustFetchGenerator identified that the change to
init( Config) had not been properly percolated through to DocumentGenerators.
Fixed.
Revision 1.1 2000/12/01 12:19:38 simon
New; Added to CVS.
- Author:
- Simon Brooke (simon@weft.co.uk)
|
Field Summary |
protected java.lang.String |
sourceURL
|
| Fields inherited from class uk.co.weft.domutil.DocumentGeneratorImpl |
allowXSLFromContext, debug, doctype, dtdPublicId, DTDPUBLICIDCONFIGTOKEN, dtdQualifiedName, DTDQUALIFIEDNAMECONFIGTOKEN, dtdSystemId, DTDSYSTEMIDCONFIGTOKEN, generateDTD, genxml, rootGenerator, rootName, xmlns, xslStylesheetName |
|
Method Summary |
Document |
generate(Context context)
Fetch the document from the URL and parse it; synchronised
because the parser is not thread safe, |
void |
init(Context config)
Initialise this generator with this servlet configuration
information |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sourceURL
protected java.lang.String sourceURL
JustFetchGenerator
public JustFetchGenerator()
generate
public Document generate(Context context)
throws GenerationException,
DOMException
- Fetch the document from the URL and parse it; synchronised
because the parser is not thread safe,
- Specified by:
generate in interface DocumentGenerator- Overrides:
generate in class DocumentGeneratorImpl
- Parameters:
context - the context for this request
- Returns:
- a document, or null if I can't sensibly generate one in this
context
- Throws:
GenerationException - if application layer code breaks
DOMException - if anything in Xerces breaks
init
public void init(Context config)
throws InitialisationException
- Initialise this generator with this servlet configuration
information
- Specified by:
init in interface DocumentGenerator- Overrides:
init in class DocumentGeneratorImpl
- Parameters:
config - my initial configuration
- Throws:
InitialisationException