File Source: DebugFilter.java

     1  /*
     2  * Licensed to the Apache Software Foundation (ASF) under one or more
     3  *  contributor license agreements.  The ASF licenses this file to You
     4  * under the Apache License, Version 2.0 (the "License"); you may not
     5  * use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *     http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.  For additional information regarding
    15  * copyright in this work, please see the NOTICE file in the top level
    16  * directory of this distribution.
    17  */
    18  
    19  package org.apache.roller.weblogger.ui.core.filters;
    20  
    21  import java.io.IOException;
    22  import javax.servlet.Filter;
    23  import javax.servlet.FilterChain;
    24  import javax.servlet.FilterConfig;
    25  import javax.servlet.ServletException;
    26  import javax.servlet.ServletRequest;
    27  import javax.servlet.ServletResponse;
    28  import javax.servlet.http.HttpServletRequest;
    29  import javax.servlet.http.HttpServletResponse;
    30  import org.apache.commons.logging.Log;
    31  import org.apache.commons.logging.LogFactory;
    32  
    33  
    34  /**
    35   * A simple debugging filter.
    36   *
    37   * This filter is NOT mapped by default and is here only for Roller developers
    38   * to use while they are working on the code and debugging things.
    39   *
    40   * @web.filter name="DebugFilter"
    41   */
         /* 
    P/P   *  Method: void org.apache.roller.weblogger.ui.core.filters.DebugFilter()
          */
    42  public class DebugFilter implements Filter {
    43      
             /* 
    P/P       *  Method: org.apache.roller.weblogger.ui.core.filters.DebugFilter__static_init
              * 
              *  Postconditions:
              *    init'ed(log)
              */
    44      private static Log log = LogFactory.getLog(DebugFilter.class);
    45      
    46      
    47      public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
    48              throws IOException, ServletException {
    49          
                 /* 
    P/P           *  Method: void doFilter(ServletRequest, ServletResponse, FilterChain)
                  * 
                  *  Preconditions:
                  *    chain != null
                  *    log != null
                  *    req != null
                  *    res != null
                  */
    50          HttpServletRequest request = (HttpServletRequest) req;
    51          HttpServletResponse response = (HttpServletResponse) res;
    52          
    53          log.info("ENTERING "+request.getRequestURL());
    54          
    55          // some info about the request and response
    56          log.info("Response Object:");
    57          log.info("   isCommited = "+response.isCommitted());
    58          log.info("   bufferSize = "+response.getBufferSize());
    59          log.info("");
    60          
    61          chain.doFilter(request, response);
    62          
    63          log.info("EXITING "+request.getRequestURL());
    64          
    65          // some info about the request and response
    66          log.info("Response Object:");
    67          log.info("   isCommited = "+response.isCommitted());
    68          log.info("   bufferSize = "+response.getBufferSize());
    69          log.info("");
    70      }
    71      
    72      
             /* 
    P/P       *  Method: void destroy()
              */
    73      public void destroy() {}
    74      
    75      
             /* 
    P/P       *  Method: void init(FilterConfig)
              */
    76      public void init(FilterConfig filterConfig) {}
    77      
    78  }








SofCheck Inspector Build Version : 2.18479
DebugFilter.java 2009-Jan-02 14:25:40
DebugFilter.class 2009-Sep-04 03:12:44