⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 externaldispatcheddecorator.java

📁 OS(OpenSymphony)的SiteMesh是一个用来在JSP中实现页面布局和装饰(layout and decoration)的框架组件
💻 JAVA
字号:
package com.opensymphony.sitemesh.webapp.decorator;import javax.servlet.ServletContext;/** * Decorator that dispatches to another path in A DIFFERENT WEB-APP in the same Servlet Container (such as a JSP or path mapped to a Servlet). * <p/> * The Content and SiteMeshContext objects are passed to the decorator using the HttpServletRequest attributes * {@link #CONTENT_KEY} and {@link #CONTEXT_KEY}. * <p/> * To dispatch to a decorator in the same web-app, use {@link DispatchedDecorator}. * * @author Joe Walnes * @since SiteMesh 3.0 */public class ExternalDispatchedDecorator extends DispatchedDecorator {    private final String webApp;    public ExternalDispatchedDecorator(String path, String webApp) {        super(path);        this.webApp = webApp;    }    protected ServletContext locateWebApp(ServletContext context) {        ServletContext externalContext = context.getContext(webApp);        if (externalContext != null) {            return externalContext;        } else {            // in a security conscious environment, the servlet container            // may return null for a given URL            throw new SecurityException("Cannot obtain ServletContext for web-app : " + webApp);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -