本文整理匯總了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);
}