Welcome 布拉格

          BlogJava 首頁 聯(lián)系 聚合 管理
            6 Posts :: 13 Stories :: 15 Comments :: 0 Trackbacks

          ?<FORM id="form1" METHOD=POST ACTION="publishAction.jsp" onSubmit="return check();">
          ? 獲取apache目錄<br/>
          ? 發(fā)布css,js,img等靜態(tài)資源文件<br/>
          ?? <br/>
          ? <br/>
          ? <%String docBase = pageContext.getServletContext().getRealPath("/");%><br/>
          ? 顯示出 <%=docBase%> 文件列表<br/>
          ? <%
          ?? File f = new File(docBase);
          ? %>
          ? <table class="listTable">
          ? <tr>
          ?? <th>JSP文件</th>
          ?? <th>啟用緩存</th>
          ?? <th>緩存文件</th>
          ?? <th></th>
          ?? <th></th>
          ? </tr>
          ? <c:forEach var="filename" items="<%=f.list()%>">
          ? <c:if test="${fn:endsWith(filename, '.jsp')}">
          ?? <tr>
          ?? <td>${filename}</td>
          ?? <td>啟用</td>
          ?? <td>
          ?? <%
          ??? String fileName = (String)pageContext.findAttribute("filename");
          ??? fileName = fileName.replaceAll(".jsp","_cache.html");
          ??? if(new File(docBase+"cache"+File.separatorChar+fileName).exists()){
          ??????? out.println(fileName);
          ??? }else{
          ????????????????
          ??? }
          ?? %>
          ?? </td>
          ?? <td><a href="deleteCacheAction.jsp?page=${filename}" title="清除緩存">清除緩存</td>
          ?? <td><a href="publishAction.jsp?page=${filename}" title="重新生成">重新生成</a></td>
          ?? </tr>
          ? </c:if>
          ? </c:forEach>
          ? </table>
          ?</FORM>


          public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
          ??????? //???? Pass control on to the next filter
          ??????? //
          ??????? //request.setCharacterEncoding("utf-8");
          ??????? HttpServletRequest req = (HttpServletRequest) request;
          ??????? String path = req.getServletPath();
          ??????? if ((!path.startsWith("/admin")) && path.endsWith(".jsp")&&req.getParameter("makeCache")==null) {
          ??????????? path = path.replaceAll(".jsp", "_cache.html");
          ????????????????? System.out.println(path);
          ????????????????????? System.out.println(req.getRequestURI());
          ????????????????????? System.out.println(req.getRequestURL());
          ??????????? request.getRequestDispatcher("/cache"+path).forward(request, response);
          ??????? } else {
          ??????????? chain.doFilter(request, response);
          ??????? }
          ??? }
          ??? /**
          ???? * Place this filter into service.
          ???? *
          ???? * @param filterConfig The filter configuration object
          ???? */
          ??? public void init(FilterConfig filterConfig) throws ServletException {
          ??????? this.filterConfig = filterConfig;
          ??????? this.enable = filterConfig.getInitParameter("enable");
          ??? }


          --------------------------------------------------------------------------------

          ?

          posted on 2007-09-10 16:46 Welcome 閱讀(268) 評論(0)  編輯  收藏 所屬分類: HTML\CSS

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 西乌| 镇安县| 崇左市| 台湾省| 上高县| 左权县| 印江| 新昌县| 肇庆市| 康马县| 历史| 祁门县| 麻城市| 昌乐县| 荣成市| 嘉祥县| 淅川县| 灵川县| 九寨沟县| 筠连县| 万州区| 巩义市| 太谷县| 波密县| 政和县| 广宗县| 时尚| 濮阳县| 库尔勒市| 广德县| 定安县| 阿巴嘎旗| 阳山县| 图们市| 西昌市| 板桥市| 新巴尔虎右旗| 二连浩特市| 十堰市| 灵山县| 隆昌县|