BlogListener.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:1k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.web.servlet;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import java.io.*;
- import java.util.*;
- import com.opensource.blog.comm.*;
- public class BlogListener
- extends HttpServlet implements ServletContextListener {
- //Notification that the web module is ready to process requests
- public void contextInitialized(ServletContextEvent sce) {
- String rootpath = sce.getServletContext().getRealPath("/");
- //System.out.println(sce.getServletContext().getServletContextName());
- if (rootpath != null) {
- rootpath = rootpath.replaceAll("\\", "/");
- }
- else {
- rootpath = "/";
- }
- Constant.ROOTPATH = rootpath;
- }
- //Notification that the servlet context is about to be shut down
- public void contextDestroyed(ServletContextEvent sce) {
- }
- }