本文整理汇总了Java中javax.servlet.http.HttpServlet.getServletContext方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServlet.getServletContext方法的具体用法?Java HttpServlet.getServletContext怎么用?Java HttpServlet.getServletContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.http.HttpServlet
的用法示例。
在下文中一共展示了HttpServlet.getServletContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
@Override
public void init(HttpServlet servlet) throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
ServletContext servletContext = servlet.getServletContext();
String configFileName = servletContext.getInitParameter("configFileName");
Properties properties = loadConfig(configFileName);
MybatisManager.init(properties.getProperty("config_dir"), "mybatis-config.xml", new MariadbLog());
HttpUtil.init("UTF-8", new HttpclientLog());
ThreadmsgLog threadmsgLog = new ThreadmsgLog();
AsyncThreadManager.init(100, 10, 3, 0, threadmsgLog);
AsyncThreadManager.start();
MsgManager.init(true, threadmsgLog);
CommonConfig.init(properties);
HOpCode.init();
MsgOpCode.init();
HttpManager.addFilter(new TokenHttpFilter());
HttpManager.addHttpListener(new AppService());
HttpManager.addHttpListener(new OrderRecordService());
HttpManager.addHttpListener(new PayService());
HttpManager.addHttpListener(new LoginService());
MsgManager.addMsgListener(new NotifyService(10));
}
示例2: init
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
@Override
public void init(HttpServlet servlet) throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
ServletContext servletContext = servlet.getServletContext();
String configFileName = servletContext.getInitParameter("configFileName");
Properties properties = loadConfig(configFileName);
MybatisManager.init(properties.getProperty("config_dir"), "mybatis-config.xml", new MariadbLog());
KeyLockManager.init(new UCenterKeyLockType().getkeyLockType(), 120000, 100, new KeylockLog());
HOpCodeUCenter.init();
CommonConfigUCenter.init();
CommonConfigUCenter.UCENTER_URL = properties.getProperty("uCenterUrl");
HttpManager.addFilter(new TokenHttpFilter());
HttpManager.addHttpListener(new UserService());
HttpManager.addHttpListener(new UserGroupService());
HttpManager.addHttpListener(new TokenService());
}
示例3: initPool
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
static private void initPool() {
if (log4j.isDebugEnabled())
log4j.debug("init");
try {
HttpServlet srv = (HttpServlet) MessageContext.getCurrentContext().getProperty(
HTTPConstants.MC_HTTP_SERVLET);
ServletContext context = srv.getServletContext();
pool = ConnectionProviderContextListener.getPool(context);
} catch (Exception e) {
log4j.error("Error : initPool");
log4j.error(e.getStackTrace());
}
}
示例4: getActivityContext
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
/**
* Find the standalone ActivityContext for this web aspectran service.
*
* @param servlet the servlet
* @return the ActivityContext for this web aspectran service
*/
public static ActivityContext getActivityContext(HttpServlet servlet) {
ServletContext servletContext = servlet.getServletContext();
String attrName = STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX + servlet.getServletName();
ActivityContext activityContext = getActivityContext(servletContext, attrName);
if (activityContext == null) {
return getActivityContext(servletContext);
}
return activityContext;
}
示例5: getCallingContext
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
public static CallingContext getCallingContext(HttpServlet servlet, HttpServletRequest req) {
return new CallingContextImpl(servlet.getServletContext(), req);
}
示例6: okJsp
import javax.servlet.http.HttpServlet; //导入方法依赖的package包/类
default void okJsp(HttpServlet servlet, HttpServletRequest req, HttpServletResponse resp, String servletPath) throws IOException, ServletException {
ServletContext servletContext = servlet.getServletContext();
RequestDispatcher namedDispatcher = servletContext.getRequestDispatcher("/WEB-INF/jsp" + servletPath);
namedDispatcher.forward(req, resp);
}