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


Java ContextHandler.Context方法代码示例

本文整理汇总了Java中org.eclipse.jetty.server.handler.ContextHandler.Context方法的典型用法代码示例。如果您正苦于以下问题:Java ContextHandler.Context方法的具体用法?Java ContextHandler.Context怎么用?Java ContextHandler.Context使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.server.handler.ContextHandler的用法示例。


在下文中一共展示了ContextHandler.Context方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onWrapServletContext

import org.eclipse.jetty.server.handler.ContextHandler; //导入方法依赖的package包/类
/**
 * onWrapServletContext Jetty的场景下需要采用一些Wrapper来替代Proxy,因为不全是接口
 * 
 * @param args
 */
public ContextHandler.Context onWrapServletContext(Object... args) {

    ServletContextHandler.Context oContext = (ServletContextHandler.Context) args[0];
    ServletContextHandlerWrapper.JettyContextWrapper ctx = new ServletContextHandlerWrapper().new JettyContextWrapper(
            oContext);
    return ctx;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:13,代码来源:JettyPlusIT.java

示例2: ServletContextHandler

import org.eclipse.jetty.server.handler.ContextHandler; //导入方法依赖的package包/类
public ServletContextHandler(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler,int options)
{
    super((ContextHandler.Context)null);
    _options=options;
    _scontext = new Context();
    _sessionHandler = sessionHandler;
    _securityHandler = securityHandler;
    _servletHandler = servletHandler;

    if (contextPath!=null)
        setContextPath(contextPath);
    
    if (parent instanceof HandlerWrapper)
        ((HandlerWrapper)parent).setHandler(this);
    else if (parent instanceof HandlerCollection)
        ((HandlerCollection)parent).addHandler(this);
    
    
    // Link the handlers
    relinkHandlers();
    
    if (errorHandler!=null)
        setErrorHandler(errorHandler);
    
    
    this.addFilter(new FilterHolder(new HTTPAuthFilter()), "/v2/*", EnumSet.allOf(DispatcherType.class));

}
 
开发者ID:xiaomin0322,项目名称:marathon-auth-plugin,代码行数:29,代码来源:ServletContextHandler.java

示例3: run

import org.eclipse.jetty.server.handler.ContextHandler; //导入方法依赖的package包/类
public void run(HtmlResponse source, HttpServletResponse response) throws IOException{
    ContextHandler.Context context = WebAppContext.getCurrentContext();
    HttpServletRequest request = requestPool.getByType(HttpServletRequest.class);

    WebContext webContext = new WebContext(request, response, context.getContext("/"));
    webContext.setVariables(source.getData());
    templateEngine.process(source.getHtmlPath(), webContext, response.getWriter());
}
 
开发者ID:ShotaOd,项目名称:carbon,代码行数:9,代码来源:TemplateEngineWrapper.java

示例4: initContextHandler

import org.eclipse.jetty.server.handler.ContextHandler; //导入方法依赖的package包/类
/**
 * Compute the field _contextHandler.<br>
 * In the case where the DefaultServlet is deployed on the HttpService it is likely that
 * this method needs to be overwritten to unwrap the ServletContext facade until we reach
 * the original jetty's ContextHandler.
 * @param servletContext The servletContext of this servlet.
 * @return the jetty's ContextHandler for this servletContext.
 */
protected ContextHandler initContextHandler(ServletContext servletContext)
{
    ContextHandler.Context scontext = ContextHandler.getCurrentContext();
    if (scontext == null)
    {
        if (servletContext instanceof ContextHandler.Context)
            return ((ContextHandler.Context)servletContext).getContextHandler();
        else
            throw new IllegalArgumentException(
                "The servletContext " + servletContext + " " + servletContext.getClass().getName() + " is not " + ContextHandler.Context.class.getName());
    }
    else
        return ContextHandler.getCurrentContext().getContextHandler();
}
 
开发者ID:lnwazg,项目名称:kit,代码行数:23,代码来源:DefaultServlet.java

示例5: getResource

import org.eclipse.jetty.server.handler.ContextHandler; //导入方法依赖的package包/类
/** get Resource to serve.
 * Map a path to a resource. The default implementation calls
 * HttpContext.getResource but derived servlets may provide
 * their own mapping.
 * @param pathInContext The path to find a resource for.
 * @return The resource to serve.
 */
@Override
public Resource getResource(String pathInContext)
{
    Resource r = null;
    if (_relativeResourceBase != null)
        pathInContext = URIUtil.addPaths(_relativeResourceBase, pathInContext);
        
    try
    {
        if (_resourceBase != null)
        {
            r = _resourceBase.addPath(pathInContext);
            if (!_contextHandler.checkAlias(pathInContext, r))
                r = null;
        }
        else if (_servletContext instanceof ContextHandler.Context)
        {
            r = _contextHandler.getResource(pathInContext);
        }
        else
        {
            URL u = _servletContext.getResource(pathInContext);
            r = _contextHandler.newResource(u);
        }
        
        if (LOG.isDebugEnabled())
            LOG.debug("Resource " + pathInContext + "=" + r);
    }
    catch (IOException e)
    {
        LOG.ignore(e);
    }
    
    if ((r == null || !r.exists()) && pathInContext.endsWith("/jetty-dir.css"))
        r = _stylesheet;
        
    return r;
}
 
开发者ID:lnwazg,项目名称:kit,代码行数:46,代码来源:DefaultServlet.java


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