本文整理汇总了Java中org.apache.jasper.JspCompilationContext.resolveRelativeUri方法的典型用法代码示例。如果您正苦于以下问题:Java JspCompilationContext.resolveRelativeUri方法的具体用法?Java JspCompilationContext.resolveRelativeUri怎么用?Java JspCompilationContext.resolveRelativeUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jasper.JspCompilationContext
的用法示例。
在下文中一共展示了JspCompilationContext.resolveRelativeUri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateTLDLocation
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private TldLocation generateTLDLocation(String uri, JspCompilationContext ctxt)
throws JasperException {
int uriType = TldLocationsCache.uriType(uri);
if (uriType == TldLocationsCache.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved",
uri);
} else if (uriType == TldLocationsCache.NOROOT_REL_URI) {
uri = ctxt.resolveRelativeUri(uri);
}
if (uri.endsWith(".jar")) {
URL url = null;
try {
url = ctxt.getResource(uri);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex
.toString());
}
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", uri);
}
return new TldLocation("META-INF/taglib.tld", url.toString());
} else if (uri.startsWith("/WEB-INF/lib/")
|| uri.startsWith("/WEB-INF/classes/") ||
(uri.startsWith("/WEB-INF/tags/") && uri.endsWith(".tld")
&& !uri.endsWith("implicit.tld"))) {
err.jspError("jsp.error.tld.invalid_tld_file", uri);
}
return new TldLocation(uri);
}
示例2: generateTLDLocation
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private String[] generateTLDLocation(String uri, JspCompilationContext ctxt)
throws JasperException {
int uriType = TldLocationsCache.uriType(uri);
if (uriType == TldLocationsCache.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved",
uri);
} else if (uriType == TldLocationsCache.NOROOT_REL_URI) {
uri = ctxt.resolveRelativeUri(uri);
}
String[] location = new String[2];
location[0] = uri;
if (location[0].endsWith("jar")) {
URL url = null;
try {
url = ctxt.getResource(location[0]);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", location[0], ex
.toString());
}
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", location[0]);
}
location[0] = url.toString();
location[1] = "META-INF/taglib.tld";
}
return location;
}
示例3: generateTLDLocation
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private TldLocation generateTLDLocation(String uri, JspCompilationContext ctxt) throws JasperException {
int uriType = TldLocationsCache.uriType(uri);
if (uriType == TldLocationsCache.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved", uri);
} else if (uriType == TldLocationsCache.NOROOT_REL_URI) {
uri = ctxt.resolveRelativeUri(uri);
}
if (uri.endsWith(".jar")) {
URL url = null;
try {
url = ctxt.getResource(uri);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex.toString());
}
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", uri);
}
return new TldLocation("META-INF/taglib.tld", url.toString());
} else if (uri.startsWith("/WEB-INF/lib/") || uri.startsWith("/WEB-INF/classes/")
|| (uri.startsWith("/WEB-INF/tags/") && uri.endsWith(".tld") && !uri.endsWith("implicit.tld"))) {
err.jspError("jsp.error.tld.invalid_tld_file", uri);
}
return new TldLocation(uri);
}
示例4: generateTldResourcePath
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private TldResourcePath generateTldResourcePath(String uri,
JspCompilationContext ctxt) throws JasperException {
// TODO: this matches the current implementation but the URL logic looks fishy
// map URI to location per JSP 7.3.6.2
if (uri.indexOf(':') != -1) {
// abs_uri, this was not found in the taglibMap so raise an error
System.out.println("TAG URI : " + uri);
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved", uri);
} else if (uri.charAt(0) != '/') {
// noroot_rel_uri, resolve against the current JSP page
uri = ctxt.resolveRelativeUri(uri);
try {
// Can't use RequestUtils.normalize since that package is not
// available to Jasper.
uri = (new URI(uri)).normalize().toString();
if (uri.startsWith("../")) {
// Trying to go outside context root
err.jspError("jsp.error.taglibDirective.uriInvalid", uri);
}
} catch (URISyntaxException e) {
err.jspError("jsp.error.taglibDirective.uriInvalid", uri);
}
}
URL url = null;
try {
url = ctxt.getResource(uri);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex.toString());
}
if (uri.endsWith(".jar")) {
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", uri);
}
return new TldResourcePath(url, uri, "META-INF/taglib.tld");
} else {
return new TldResourcePath(url, uri);
}
}
示例5: generateTLDLocation
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private String[] generateTLDLocation(String uri,
JspCompilationContext ctxt)
throws JasperException {
int uriType = TldScanner.uriType(uri);
if (uriType == TldScanner.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved",
uri);
} else if (uriType == TldScanner.NOROOT_REL_URI) {
uri = ctxt.resolveRelativeUri(uri);
}
String[] location = new String[2];
location[0] = uri;
if (location[0].endsWith("jar")) {
URL url = null;
try {
url = ctxt.getResource(location[0]);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", location[0],
ex.toString());
}
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", location[0]);
}
location[0] = url.toString();
location[1] = "META-INF/taglib.tld";
}
return location;
}
示例6: generateTLDLocation
import org.apache.jasper.JspCompilationContext; //导入方法依赖的package包/类
private TldLocation generateTLDLocation(String uri, JspCompilationContext ctxt)
throws JasperException {
int uriType = TldLocationsCache.uriType(uri);
if (uriType == TldLocationsCache.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved",
uri);
} else if (uriType == TldLocationsCache.NOROOT_REL_URI) {
uri = ctxt.resolveRelativeUri(uri);
}
if (uri.endsWith(".jar")) {
URL url = null;
try {
url = ctxt.getResource(uri);
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex
.toString());
}
if (url == null) {
err.jspError("jsp.error.tld.missing_jar", uri);
}
return new TldLocation("META-INF/taglib.tld", url.toString());
} else {
return new TldLocation(uri);
}
}