|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.source.SourceUtil
public final class SourceUtil
This class contains some utility methods for the source resolving.
Method Summary | |
---|---|
static String |
getAuthority(String uri)
Return the authority of a URI. |
static String |
getFragment(String uri)
Return the fragment of a URI. |
static InputSource |
getInputSource(Source source)
Get an InputSource object |
static String |
getPath(String uri)
Return the path of a URI. |
static String |
getPathWithoutAuthority(String uri)
Return the path of a URI, if the URI can't contains a authority. |
static String |
getQuery(String uri)
Return the query of a URI. |
static String |
getScheme(String uri)
Return the scheme of a URI. |
static Source |
getSource(String uri,
Parameters typeParameters,
SourceParameters resourceParameters,
SourceResolver resolver)
Get a Source object |
static ProcessingException |
handle(SourceException se)
Make a ProcessingException from a SourceException. |
static ProcessingException |
handle(String message,
SourceException se)
Make a ProcessingException from a SourceException. |
static void |
handleSAXException(String source,
SAXException e)
Handle SAXException catched in Generator's generate method. |
static void |
parse(ComponentManager manager,
Source source,
ContentHandler handler)
Deprecated. Use parse(ServiceManager, Source, ContentHandler) . |
static void |
parse(ServiceManager manager,
Source source,
ContentHandler handler)
Generates SAX events from the given source by parsing it. |
static DocumentFragment |
readDOM(String location,
Parameters typeParameters,
SourceParameters parameters,
SourceResolver resolver)
Deprecated. This method will be removed in future versions. |
static void |
toCharacters(Source source,
String encoding,
ContentHandler handler)
Generates character SAX events from the given source. |
static Document |
toDOM(ServiceManager manager,
Source source)
Generates a DOM from the given source |
static Document |
toDOM(ServiceManager manager,
String mimeTypeHint,
Source source)
Generates a DOM from the given source |
static Document |
toDOM(Source source)
Generates a DOM from the given source |
static void |
toSAX(ComponentManager manager,
Source source,
String mimeTypeHint,
ContentHandler handler)
Deprecated. Use the toSAX(ServiceManager, Source, String, ContentHandler)
method instead. |
static void |
toSAX(ServiceManager manager,
Source source,
String mimeTypeHint,
ContentHandler handler)
Generates SAX events from the given source NOTE: If the implementation can produce lexical events, care should be taken that handler can actually
directly implement the LexicalHandler interface! |
static void |
toSAX(Source source,
ContentHandler handler)
Generates SAX events from the given source. |
static void |
toSAX(Source source,
ContentHandler handler,
Parameters typeParameters,
boolean filterDocumentEvent)
Generates SAX events from the given source NOTE: If the implementation can produce lexical events, care should be taken that handler can actually
directly implement the LexicalHandler interface! |
static void |
toSAX(Source source,
String mimeTypeHint,
ContentHandler handler)
Generates SAX events from the given source by using XMLizer. |
static void |
toSAX(XMLizable source,
ContentHandler handler)
Generates SAX events from the XMLizable and handle SAXException. |
static void |
writeDOM(String location,
Parameters typeParameters,
SourceParameters parameters,
DocumentFragment frag,
SourceResolver resolver,
String serializerName)
Deprecated. This method will be removed in future versions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void toSAX(XMLizable source, ContentHandler handler) throws SAXException, IOException, ProcessingException
source
- the data
SAXException
IOException
ProcessingException
public static void toSAX(Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void toSAX(Source source, String mimeTypeHint, ContentHandler handler) throws SAXException, IOException, ProcessingException
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void toSAX(ComponentManager manager, Source source, String mimeTypeHint, ContentHandler handler) throws SAXException, IOException, ProcessingException
toSAX(ServiceManager, Source, String, ContentHandler)
method instead.
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void toSAX(ServiceManager manager, Source source, String mimeTypeHint, ContentHandler handler) throws SAXException, IOException, ProcessingException
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void parse(ComponentManager manager, Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException
parse(ServiceManager, Source, ContentHandler)
.
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void toCharacters(Source source, String encoding, ContentHandler handler) throws SAXException, IOException, ProcessingException
source
- The dataencoding
- The character encoding of the data
SAXException
IOException
ProcessingException
public static void parse(ServiceManager manager, Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static void toSAX(Source source, ContentHandler handler, Parameters typeParameters, boolean filterDocumentEvent) throws SAXException, IOException, ProcessingException
NOTE: If the implementation can produce lexical events,
care should be taken that handler
can actually
directly implement the LexicalHandler interface!
source
- the data
ProcessingException
- if no suitable converter is found
SAXException
IOException
public static Document toDOM(Source source) throws SAXException, IOException, ProcessingException
source
- The data
IOException
- If a io exception occurs.
ProcessingException
- if no suitable converter is found
SAXException
- If a SAX exception occurs.public static Document toDOM(ServiceManager manager, Source source) throws SAXException, IOException, ProcessingException
source
- The data
IOException
- If a io exception occurs.
ProcessingException
- if no suitable converter is found
SAXException
- If a SAX exception occurs.public static Document toDOM(ServiceManager manager, String mimeTypeHint, Source source) throws SAXException, IOException, ProcessingException
source
- The data
IOException
- If a io exception occurs.
ProcessingException
- if no suitable converter is found
SAXException
- If a SAX exception occurs.public static ProcessingException handle(SourceException se)
se
- Source exception
public static ProcessingException handle(String message, SourceException se)
message
- Additional exception message.se
- Source exception.
public static void handleSAXException(String source, SAXException e) throws ProcessingException, IOException, SAXException
source
- Generator's sourcee
- SAXException happened in the generator's generate method.
ProcessingException
IOException
SAXException
public static InputSource getInputSource(Source source) throws IOException, ProcessingException
source
- Source.
IOException
- If a io exception occurs.
ProcessingException
- If an exception occurs during
processing.public static Source getSource(String uri, Parameters typeParameters, SourceParameters resourceParameters, SourceResolver resolver) throws IOException, SAXException, SourceException
Source
object
uri
- URI of the source.typeParameters
- Type of Source query. Currently, only
method
parameter (value typically GET
or
POST
) is recognized. May be null
.resourceParameters
- Parameters of the source. May be null
resolver
- Resolver for the source.
IOException
- If a io exception occurs.
SAXException
- If a SAX exception occurs.
SourceException
- If the source an exception throws.public static void writeDOM(String location, Parameters typeParameters, SourceParameters parameters, DocumentFragment frag, SourceResolver resolver, String serializerName) throws ProcessingException
location
- URI of the SourcetypeParameters
- Type of Source query. Currently, only
method
parameter (value typically GET
or
POST
) is recognized. May be null
.parameters
- Parameters (e.g. URL params) of the source.
May be null
frag
- DOM fragment to serialize to the Sourceresolver
- Resolver for the source.serializerName
- The serializer to use
ProcessingException
public static DocumentFragment readDOM(String location, Parameters typeParameters, SourceParameters parameters, SourceResolver resolver) throws ProcessingException
location
- URI of the SourcetypeParameters
- Type of Source query. Currently, only
method
parameter (value typically GET
or
POST
) is recognized. May be null
.parameters
- Parameters (e.g. URL params) of the source.
May be null
resolver
- Resolver for the source.
DocumentFragment
constructed from the specified
source.
ProcessingException
public static String getScheme(String uri)
uri
- Uniform resource identifier.
public static String getAuthority(String uri)
uri
- Uniform resource identifier.
public static String getPath(String uri)
uri
- Uniform resource identifier.
public static String getPathWithoutAuthority(String uri)
uri
- Uniform resource identifier.
public static String getQuery(String uri)
uri
- Uniform resource identifier.
public static String getFragment(String uri)
uri
- Uniform resource identifier.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |