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 閱讀(267) 評論(0)  編輯  收藏 所屬分類: HTML\CSS

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


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 鸡东县| 湖南省| 德阳市| 库车县| 宁武县| 郓城县| 台安县| 汉寿县| 蕲春县| 康平县| 英超| 巫山县| 南城县| 涡阳县| 南和县| 荥经县| 房山区| 岳阳县| 安新县| 钟山县| 天水市| 驻马店市| 体育| 顺平县| 兰西县| 吉安市| 西安市| 米泉市| 霍山县| 长岭县| 高安市| 浙江省| 衡阳县| 宣恩县| 湘潭县| 海盐县| 策勒县| 德钦县| 平邑县| 东平县| 龙江县|