本文整理了Java中org.exolab.castor.mapping.Mapping.setBaseURL()
方法的一些代码示例,展示了Mapping.setBaseURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mapping.setBaseURL()
方法的具体详情如下:
包路径:org.exolab.castor.mapping.Mapping
类名称:Mapping
方法名:setBaseURL
[英]Sets the base URL for the mapping and related files. If the base URL is known, files can be included using relative names. Any URL can be passed, if the URL can serve as a base URL it will be used. If url is an absolute path, it is converted to a file URL.
[中]设置映射和相关文件的基本URL。如果基本URL已知,则可以使用相对名称包含文件。可以传递任何URL,如果该URL可以用作基本URL,则将使用该URL。如果url是绝对路径,则会将其转换为文件url。
代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor
/**
* Loads the mapping from the specified URL. If an entity resolver
* was specified, will use the entity resolver to resolve the URL.
* This method is also used to load mappings referenced from another
* mapping or configuration file.
*
* @param url The URL of the mapping file.
* @param type The source type.
* @throws IOException An error occured when reading the mapping file.
* @throws MappingException The mapping file is invalid.
*/
public void loadMapping(final String url, final String type)
throws IOException, MappingException {
String location = url;
if (_resolver.getBaseURL() == null) {
setBaseURL(location);
location = URIUtils.getRelativeURI(location);
}
try {
InputSource source = _resolver.resolveEntity(null, location);
if (source == null) { source = new InputSource(location); }
if (source.getSystemId() == null) { source.setSystemId(location); }
LOG.info(Messages.format("mapping.loadingFrom", location));
loadMapping(source, type);
} catch (SAXException ex) {
throw new MappingException(ex);
}
}
代码示例来源:origin: org.codehaus.castor/castor-xml
String location = url;
if (_resolver.getBaseURL() == null) {
setBaseURL(location);
location = URIUtils.getRelativeURI(location);
代码示例来源:origin: org.codehaus.castor/castor-jdo
if (baseURI != null) { mapping.setBaseURL(baseURI); }
内容来源于网络,如有侵权,请联系作者删除!