Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * RHQ Management Platform
  * Copyright (C) 2005-2008 Red Hat, Inc.
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation version 2 of the License.
  *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
package org.rhq.helpers.rtfilter.filter;
Extend the ServletResponse to be able to retrieve the status code. I would love to correctly use

Author(s):
Heiko W. Rupp
Override:
but this needs to run with jre1.4 as well.
public class RtFilterResponseWrapper extends HttpServletResponseWrapper {
    
Http status code (200=ok, 404=not found, 500=error etc. Default is 200, as the code only gets set when there is something not ok.
    private int statusCode = 200;
    public RtFilterResponseWrapper(HttpServletResponse response) {
        super(response);
    }
    public RtFilterResponseWrapper(ServletResponse response) {
        super((HttpServletResponseresponse);
    }
    public void setStatus(int code) {
         = code;
        super.setStatus(code);
    }
    public void setStatus(int codeString msg) {
         = code;
        super.setStatus(codemsg);
    }
    public int getStatus() {
        return ;
    }
    public void sendError(int scthrows IOException {
         = sc;
        super.sendError(sc);
    }
    public void sendError(int scString msgthrows IOException {
         = sc;
        super.sendError(scmsg);
    }
New to GrepCode? Check out our FAQ X