當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。