當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServlet.getServletContext方法代碼示例

本文整理匯總了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));
}
 
開發者ID:dianbaer,項目名稱:epay,代碼行數:24,代碼來源:Expand.java

示例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());
}
 
開發者ID:dianbaer,項目名稱:startpoint,代碼行數:17,代碼來源:Expand.java

示例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());
  }
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:14,代碼來源:VersionUtility.java

示例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;
}
 
開發者ID:aspectran,項目名稱:aspectran,代碼行數:16,代碼來源:AspectranWebService.java

示例5: getCallingContext

import javax.servlet.http.HttpServlet; //導入方法依賴的package包/類
public static CallingContext getCallingContext(HttpServlet servlet, HttpServletRequest req) {
  return new CallingContextImpl(servlet.getServletContext(), req);
}
 
開發者ID:opendatakit,項目名稱:aggregate,代碼行數:4,代碼來源:ContextFactory.java

示例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);
}
 
開發者ID:Prygan,項目名稱:EventManager-JEE,代碼行數:8,代碼來源:HttpErrorResponse.java


注:本文中的javax.servlet.http.HttpServlet.getServletContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。