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)航:
           
          主站蜘蛛池模板: 上犹县| 绩溪县| 浠水县| 唐山市| 志丹县| 湘潭市| 永德县| 正定县| 宁化县| 曲阜市| 浦城县| 乌兰察布市| 双流县| 平邑县| 安福县| 辽阳市| 临夏县| 皋兰县| 长垣县| 盘山县| 攀枝花市| 沙洋县| 元氏县| 罗江县| 时尚| 柘城县| 天水市| 潍坊市| 富平县| 卢龙县| 泗水县| 昭平县| 云龙县| 苏州市| 京山县| 呈贡县| 绵竹市| 惠来县| 百色市| 松滋市| 邹城市|