| java.lang.Object org.apache.cocoon.components.source.SourceUtil
SourceUtil | final public class SourceUtil (Code) | | This class contains some utility methods for the source resolving.
author: Carsten Ziegeler author: Stephan Michels version: $Id: SourceUtil.java 485224 2006-12-10 17:24:05Z cziegeler $ |
Method Summary | |
public static String | getAuthority(String uri) Return the authority of a URI. | public static String | getFragment(String uri) Return the fragment of a URI. | public static InputSource | getInputSource(Source source) Get an InputSource object
Parameters: source - Source. | public static String | getPath(String uri) Return the path of a URI. | public static String | getPathWithoutAuthority(String uri) Return the path of a URI, if the URI can't contains a authority.
This implementation differ to the RFC 2396.
Parameters: uri - Uniform resource identifier. | public static String | getQuery(String uri) Return the query of a URI. | public static String | getScheme(String uri) Return the scheme of a URI. | public static Source | getSource(String uri, Parameters typeParameters, SourceParameters resourceParameters, SourceResolver resolver) Get a Source object
Parameters: uri - URI of the source. Parameters: typeParameters - Type of Source query. | public static ProcessingException | handle(SourceException se) Make a ProcessingException from a SourceException. | public static ProcessingException | handle(String message, SourceException se) Make a ProcessingException from a SourceException.
If the exception is a SourceNotFoundException then a
ResourceNotFoundException is thrown.
Parameters: message - Additional exception message. Parameters: se - Source exception. | public static void | handleSAXException(String source, SAXException e) Handle SAXException catched in Generator's generate method. | public static void | parse(ComponentManager manager, Source source, ContentHandler handler) Generates SAX events from the given source by parsing it. | public static void | parse(ServiceManager manager, Source source, ContentHandler handler) Generates SAX events from the given source by parsing it. | public static DocumentFragment | readDOM(String location, Parameters typeParameters, SourceParameters parameters, SourceResolver resolver) Read a DOM Fragment from a source
Parameters: location - URI of the Source Parameters: typeParameters - Type of Source query. | public static void | toCharacters(Source source, String encoding, ContentHandler handler) Generates character SAX events from the given source. | public static Document | toDOM(Source source) | public static Document | toDOM(ServiceManager manager, Source source) | public static Document | toDOM(ServiceManager manager, String mimeTypeHint, Source source) | public static void | toSAX(XMLizable source, ContentHandler handler) Generates SAX events from the XMLizable and handle SAXException. | public static void | toSAX(Source source, ContentHandler handler) Generates SAX events from the given source. | public static void | toSAX(Source source, String mimeTypeHint, ContentHandler handler) Generates SAX events from the given source by using XMLizer. | public static void | toSAX(ComponentManager manager, Source source, String mimeTypeHint, ContentHandler handler) Generates SAX events from the given source by using XMLizer. | public static void | toSAX(ServiceManager manager, Source source, String mimeTypeHint, ContentHandler handler) | public static void | toSAX(Source source, ContentHandler handler, Parameters typeParameters, boolean filterDocumentEvent) | public static void | writeDOM(String location, Parameters typeParameters, SourceParameters parameters, DocumentFragment frag, SourceResolver resolver, String serializerName) Write a DOM Fragment to a source.
If the source is a ModifiableSource the interface is used.
If not, the source is invoked with an additional parameter named
"content" containing the XML.
Parameters: location - URI of the Source Parameters: typeParameters - Type of Source query. |
getAuthority | public static String getAuthority(String uri)(Code) | | Return the authority of a URI. This authority is
typically defined by an Internet-based server or a scheme-specific
registry of naming authorities
(see RFC 2396).
Parameters: uri - Uniform resource identifier. Scheme of the URI. |
getFragment | public static String getFragment(String uri)(Code) | | Return the fragment of a URI. When a URI reference is used to perform
a retrieval action on the identified resource, the optional fragment
identifier, consists of additional reference information to be
interpreted by the user agent after the retrieval action has been
successfully completed
(see RFC 2396).
Parameters: uri - Uniform resource identifier. Fragment of the URI. |
getPath | public static String getPath(String uri)(Code) | | Return the path of a URI. The path contains data, specific to the
authority (or the scheme if there is no authority component),
identifying the resource within the scope of that scheme and authority
(see RFC 2396).
Parameters: uri - Uniform resource identifier. Path of the URI. |
getPathWithoutAuthority | public static String getPathWithoutAuthority(String uri)(Code) | | Return the path of a URI, if the URI can't contains a authority.
This implementation differ to the RFC 2396.
Parameters: uri - Uniform resource identifier. Path of the URI. |
getQuery | public static String getQuery(String uri)(Code) | | Return the query of a URI. The query is a string of information to
be interpreted by the resource
(see RFC 2396).
Parameters: uri - Uniform resource identifier. Query of the URI. |
getScheme | public static String getScheme(String uri)(Code) | | Return the scheme of a URI. Just as there are many different methods
of access to resources, there are a variety of schemes for identifying
such resources.
(see RFC 2396).
Parameters: uri - Uniform resource identifier. Scheme of the URI. |
getSource | public static Source getSource(String uri, Parameters typeParameters, SourceParameters resourceParameters, SourceResolver resolver) throws IOException, SAXException, SourceException(Code) | | Get a Source object
Parameters: uri - URI of the source. Parameters: typeParameters - Type of Source query. Currently, onlymethod parameter (value typically GET orPOST ) is recognized. May be null . Parameters: resourceParameters - Parameters of the source. May be null Parameters: resolver - Resolver for the source. The resolved source. throws: IOException - If a io exception occurs. throws: SAXException - If a SAX exception occurs. throws: SourceException - If the source an exception throws. |
handle | public static ProcessingException handle(SourceException se)(Code) | | Make a ProcessingException from a SourceException.
If the exception is a SourceNotFoundException then a
ResourceNotFoundException is thrown.
Parameters: se - Source exception Created processing exception. |
handle | public static ProcessingException handle(String message, SourceException se)(Code) | | Make a ProcessingException from a SourceException.
If the exception is a SourceNotFoundException then a
ResourceNotFoundException is thrown.
Parameters: message - Additional exception message. Parameters: se - Source exception. Created processing exception. |
parse | public static void parse(ServiceManager manager, Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException(Code) | | Generates SAX events from the given source by parsing it.
NOTE: If the implementation can produce lexical events,
care should be taken that handler can actually
directly implement the LexicalHandler interface!
Parameters: source - the data throws: ProcessingException - if no suitable converter is found |
readDOM | public static DocumentFragment readDOM(String location, Parameters typeParameters, SourceParameters parameters, SourceResolver resolver) throws ProcessingException(Code) | | Read a DOM Fragment from a source
Parameters: location - URI of the Source Parameters: typeParameters - Type of Source query. Currently, onlymethod parameter (value typically GET orPOST ) is recognized. May be null . Parameters: parameters - Parameters (e.g. URL params) of the source.May be null Parameters: resolver - Resolver for the source. DOM DocumentFragment constructed from the specifiedsource. throws: ProcessingException - |
toSAX | public static void toSAX(Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException(Code) | | 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!
Parameters: source - the data throws: ProcessingException - if no suitable converter is found |
toSAX | public static void toSAX(Source source, String mimeTypeHint, ContentHandler handler) throws SAXException, IOException, ProcessingException(Code) | | Generates SAX events from the given source by using XMLizer.
Current sitemap manager will be used to lookup XMLizer.
NOTE: If the implementation can produce lexical events,
care should be taken that handler can actually
directly implement the LexicalHandler interface!
Parameters: source - the data throws: ProcessingException - if no suitable converter is found |
toSAX | public static void toSAX(ServiceManager manager, Source source, String mimeTypeHint, ContentHandler handler) throws SAXException, IOException, ProcessingException(Code) | | 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!
Parameters: source - the data throws: ProcessingException - if no suitable converter is found |
toSAX | public static void toSAX(Source source, ContentHandler handler, Parameters typeParameters, boolean filterDocumentEvent) throws SAXException, IOException, ProcessingException(Code) | | 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!
Parameters: source - the data throws: ProcessingException - if no suitable converter is found |
writeDOM | public static void writeDOM(String location, Parameters typeParameters, SourceParameters parameters, DocumentFragment frag, SourceResolver resolver, String serializerName) throws ProcessingException(Code) | | Write a DOM Fragment to a source.
If the source is a ModifiableSource the interface is used.
If not, the source is invoked with an additional parameter named
"content" containing the XML.
Parameters: location - URI of the Source Parameters: typeParameters - Type of Source query. Currently, onlymethod parameter (value typically GET orPOST ) is recognized. May be null . Parameters: parameters - Parameters (e.g. URL params) of the source.May be null Parameters: frag - DOM fragment to serialize to the Source Parameters: resolver - Resolver for the source. Parameters: serializerName - The serializer to use throws: ProcessingException - |
|
|