FileDocCategorySizeDatePackage
PolicyConfigResolver.javaAPI DocExample4471Tue May 29 16:56:36 BST 2007com.sun.xml.ws.policy.jaxws

PolicyConfigResolver

public class PolicyConfigResolver extends Object implements com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver
Assumes that a given XML entity holds a valid URL and returns an XMLEntityResolver.Parser for that URL. An XMLEntityResolver.Parser is essentially a wrapper around an XMLStreamReader.
author
Jakub Podlesak (jakub.podlesak at sun.com)

Fields Summary
private static final com.sun.xml.ws.policy.privateutil.PolicyLogger
LOGGER
private static final XMLInputFactory
xmlInputFactory
Constructors Summary
Methods Summary
public com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver.ParserresolveEntity(java.lang.String publicId, java.lang.String systemId)
Assumes that a given XML entity holds a valid URL and returns an XMLEntityResolver.Parser for that URL.

param
publicId The public ID of the entity. This parameter is ignored.
param
systemId The system ID of the entity. Must be a valid URL.
return
A parser (i.e. an XMLStreamReader) for the systemId URL.
throws
XMLStreamException If the XMLStreamReader could not be created
throws
IOException If the URL was invalid or a connection to the URL failed
see
javax.xml.stream.XMLStreamReader
see
com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver.Parser


                                                                                        
           
           
        
        LOGGER.entering(publicId, systemId);
        Parser parser = null;

        try {
            // TODO: think about using alg from http://www.w3.org/International/O-URL-code.html
            final URL systemUrl = new URL(PolicyUtils.Rfc2396.unquote(systemId));
            final InputStream input = systemUrl.openStream();
            final XMLStreamReader reader = new TidyXMLStreamReader(xmlInputFactory.createXMLStreamReader(systemId, input), input);

            parser = new Parser(systemUrl, reader);
            return parser;
        } finally {
            LOGGER.exiting(parser);
        }