Top Description Inners Fields Constructors Methods
org.eclipse.jetty.xml

public Class BaseClassCatalog

extends Object
implements Catalog, EntityResolver
Class Inheritance
All Implemented Interfaces
org.xml.sax.EntityResolver, javax.xml.catalog.Catalog
Imports
java.io.FileNotFoundException, .IOException, .InputStream, java.net.URI, .URISyntaxException, .URL, java.util.HashMap, .Locale, .Map, .Objects, java.util.stream.Stream, javax.xml.catalog.Catalog, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, org.eclipse.jetty.util.TypeUtil, org.w3c.dom.Document, .Element, .NodeList, org.xml.sax.EntityResolver, .InputSource, .SAXException

A catalog implementation where the xml:base is defined externally of the catalog XML, allowing for runtime determination of the xml:base (such as pointing to the contents of a remote location)

This is a temporary Catalog implementation, and should be removed once all of our usages of servlet-api-<ver>.jar have their own catalog.xml files.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Map<String, String>
private final Map<String, String>

Constructor Summary

AccessConstructor and Description
private
BaseClassCatalog(Map<String, String> publicIdMap, Map<String, String> systemIdMap)

Method Summary

Modifier and TypeMethod and Description
public Stream<Catalog>
catalogs()

Implements javax.xml.catalog.Catalog.catalogs.

Returns a sequential Stream of alternative Catalogs specified using the nextCatalog entries in the current catalog, and as the input of catalog files excluding the current catalog (that is, the first in the input list) when the Catalog object is created by the CatalogManager.

public static BaseClassCatalog
load(URI uriToCatalogXml, Class<?> baseClass)

public String
matchPublic(String
the public identifier of the entity to be matched
publicId
)

Implements javax.xml.catalog.Catalog.matchPublic.

Attempts to find a matching entry in the catalog by publicId.

public String
matchSystem(String
the system identifier of the entity to be matched
systemId
)

Implements javax.xml.catalog.Catalog.matchSystem.

Attempts to find a matching entry in the catalog by systemId.

public String
matchURI(String
the URI reference of the entity to be matched
uri
)

Implements javax.xml.catalog.Catalog.matchURI.

Attempts to find a matching entry in the catalog by the uri element.

public InputSource
resolveEntity(String
The public identifier of the external entity being referenced, or null if none was supplied.
publicId
,
String
The system identifier of the external entity being referenced.
systemId
)

Implements org.xml.sax.EntityResolver.resolveEntity.

Implementation of org.xml.sax.EntityResolver

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

publicIdMapback to summary
private final Map<String, String> publicIdMap
systemIdMapback to summary
private final Map<String, String> systemIdMap

Constructor Detail

BaseClassCatalogback to summary
private BaseClassCatalog(Map<String, String> publicIdMap, Map<String, String> systemIdMap)

Method Detail

catalogsback to summary
public Stream<Catalog> catalogs()

Implements javax.xml.catalog.Catalog.catalogs.

Doc from javax.xml.catalog.Catalog.catalogs.

Returns a sequential Stream of alternative Catalogs specified using the nextCatalog entries in the current catalog, and as the input of catalog files excluding the current catalog (that is, the first in the input list) when the Catalog object is created by the CatalogManager.

The order of Catalogs in the returned stream is the same as the order in which the corresponding nextCatalog entries appear in the current catalog. The alternative catalogs from the input file list are appended to the end of the stream in the order they are entered.

Returns:Stream<Catalog>

a sequential Stream of Catalogs

Annotations
@Override
loadback to summary
public static BaseClassCatalog load(URI uriToCatalogXml, Class<?> baseClass) throws IOException
matchPublicback to summary
public String matchPublic(String publicId)

Implements javax.xml.catalog.Catalog.matchPublic.

Doc from javax.xml.catalog.Catalog.matchPublic.

Attempts to find a matching entry in the catalog by publicId. The method searches through the public-type entries, including public, delegatePublic, and group entries in the current catalog in order to find a match.

Refer to the description about Feature PREFER in the table Catalog Features in class CatalogFeatures. Public entries are only considered if the prefer is public and system entries are not found.

Resolution follows the steps listed below:

  • If a matching public entry is found, it is returned immediately.
  • If more than one delegatePublic entry matches, the matching entry with the longest matching publicIdStartString value is returned.
Parameters
publicId:String

the public identifier of the entity to be matched

Returns:String

a URI string if a mapping is found, or null otherwise

Annotations
@Override
matchSystemback to summary
public String matchSystem(String systemId)

Implements javax.xml.catalog.Catalog.matchSystem.

Doc from javax.xml.catalog.Catalog.matchSystem.

Attempts to find a matching entry in the catalog by systemId.

The method searches through the system-type entries, including system, rewriteSystem, systemSuffix, delegateSystem, and group entries in the current catalog in order to find a match.

Resolution follows the steps listed below:

  • If a matching system entry exists, it is returned immediately.
  • If more than one rewriteSystem entry matches, the matching entry with the longest normalized systemIdStartString value is returned.
  • If more than one systemSuffix entry matches, the matching entry with the longest normalized systemIdSuffix value is returned.
  • If more than one delegateSystem entry matches, the matching entry with the longest matching systemIdStartString value is returned.
Parameters
systemId:String

the system identifier of the entity to be matched

Returns:String

a URI string if a mapping is found, or null otherwise

Annotations
@Override
matchURIback to summary
public String matchURI(String uri)

Implements javax.xml.catalog.Catalog.matchURI.

Doc from javax.xml.catalog.Catalog.matchURI.

Attempts to find a matching entry in the catalog by the uri element.

The method searches through the uri-type entries, including uri, rewriteURI, uriSuffix, delegateURI and group entries in the current catalog in order to find a match.

Resolution follows the steps listed below:

  • If a matching uri entry is found, it is returned immediately.
  • If more than one rewriteURI entry matches, the matching entry with the longest normalized uriStartString value is returned.
  • If more than one uriSuffix entry matches, the matching entry with the longest normalized uriSuffix value is returned.
  • If more than one delegatePublic entry matches, the matching entry with the longest matching uriStartString value is returned.
Parameters
uri:String

the URI reference of the entity to be matched

Returns:String

a URI string if a mapping is found, or null otherwise

Annotations
@Override
resolveEntityback to summary
public InputSource resolveEntity(String publicId, String systemId)

Implements org.xml.sax.EntityResolver.resolveEntity.

Implementation of org.xml.sax.EntityResolver

Parameters
publicId:String

Doc from org.xml.sax.EntityResolver.resolveEntity.

The public identifier of the external entity being referenced, or null if none was supplied.

systemId:String

Doc from org.xml.sax.EntityResolver.resolveEntity.

The system identifier of the external entity being referenced.

Returns:InputSource

Doc from org.xml.sax.EntityResolver.resolveEntity.

An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.

Annotations
@Override
See Also
org.xml.sax.EntityResolver#resolveEntity(String, String)
org.eclipse.jetty.xml back to summary

private Class BaseClassCatalog.CatalogReader

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final URI

Constructor Summary

AccessConstructor and Description
public
CatalogReader(URI uriToCatalogXml, Class<?> baseClass)

Method Summary

Modifier and TypeMethod and Description
private Map<String, String>
getMapping(Element root, String elementName, String attrIdName)

public BaseClassCatalog
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseClassback to summary
private final Class<?> baseClass
catalogUriback to summary
private final URI catalogUri

Constructor Detail

CatalogReaderback to summary
public CatalogReader(URI uriToCatalogXml, Class<?> baseClass)

Method Detail

getMappingback to summary
private Map<String, String> getMapping(Element root, String elementName, String attrIdName) throws IOException
parseback to summary
public BaseClassCatalog parse() throws IOException