本文整理匯總了Java中org.eclipse.jetty.webapp.WebAppContext.getServletContext方法的典型用法代碼示例。如果您正苦於以下問題:Java WebAppContext.getServletContext方法的具體用法?Java WebAppContext.getServletContext怎麽用?Java WebAppContext.getServletContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.webapp.WebAppContext
的用法示例。
在下文中一共展示了WebAppContext.getServletContext方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onAppStarting
import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
/**
* onAppStarting
*
* @param args
*/
public void onAppStarting(Object... args) {
WebAppContext sc = (WebAppContext) args[0];
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.WEBCONTAINER_INIT);
context.put(InterceptConstants.WEBAPPLOADER, sc.getClassLoader());
context.put(InterceptConstants.WEBWORKDIR, sc.getServletContext().getRealPath(""));
context.put(InterceptConstants.CONTEXTPATH, sc.getContextPath());
context.put(InterceptConstants.APPNAME, sc.getDisplayName());
ServletContext sContext = sc.getServletContext();
context.put(InterceptConstants.SERVLET_CONTEXT, sContext);
getBasePath(context, sContext);
iSupport.doIntercept(context);
}
示例2: onAppStop
import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
/**
* onAppStop
*
* @param args
*/
public void onAppStop(Object... args) {
System.out.println("---------------->onAppStop");
WebAppContext sc = getWebAppContext(args);
if (sc == null) {
return;
}
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.WEBCONTAINER_STOPPED);
context.put(InterceptConstants.WEBAPPLOADER, sc.getClassLoader());
context.put(InterceptConstants.WEBWORKDIR, sc.getServletContext().getRealPath(""));
context.put(InterceptConstants.CONTEXTPATH, sc.getContextPath());
context.put(InterceptConstants.APPNAME, sc.getDisplayName());
ServletContext sContext = sc.getServletContext();
context.put(InterceptConstants.SERVLET_CONTEXT, sContext);
getBasePath(context, sContext);
iSupport.doIntercept(context);
}
示例3: onAppStart
import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
/**
* onAppStart
*
* @param args
*/
public void onAppStart(Object... args) {
WebAppContext sc = getWebAppContext(args);
if (sc == null) {
return;
}
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.WEBCONTAINER_STARTED);
context.put(InterceptConstants.WEBAPPLOADER, sc.getClassLoader());
context.put(InterceptConstants.WEBWORKDIR, sc.getServletContext().getRealPath(""));
context.put(InterceptConstants.CONTEXTPATH, sc.getContextPath());
context.put(InterceptConstants.APPNAME, sc.getDisplayName());
ServletContext sContext = sc.getServletContext();
context.put(InterceptConstants.SERVLET_CONTEXT, sContext);
getBasePath(context, sContext);
iSupport.doIntercept(context);
// GlobalFilter
sc.addFilter("com.creditease.monitor.jee.filters.GlobalFilter", "/*", EnumSet.of(DispatcherType.REQUEST));
}