当前位置: 首页>>代码示例>>Java>>正文


Java JspCompilationContext.resolveRelativeUri方法代码示例

本文整理汇总了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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:33,代码来源:TagLibraryInfoImpl.java

示例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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:TagLibraryInfoImpl.java

示例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);
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:28,代码来源:TagLibraryInfoImpl.java

示例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);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:41,代码来源:TagLibraryInfoImpl.java

示例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;
   }
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:32,代码来源:TagLibraryInfoImpl.java

示例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);
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:28,代码来源:TagLibraryInfoImpl.java


注:本文中的org.apache.jasper.JspCompilationContext.resolveRelativeUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。