Code Search for Developers
 
 
  

StatusCodeFilter.java from Tea Stats at Krugle


Show StatusCodeFilter.java syntax highlighted

/*
 * This file is distributed under the GPL v2 as part of teastats site statistics package
 * http://teastats.sourceforge.net
 */
package net.time4tea.webstats.filter.http;

import net.time4tea.webstats.record.Page;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;

/**
 * Originally richja Feb 11, 2006
 */
public class StatusCodeFilter extends BaseMatcher<Page> {

    private long min = 0;
    private long max = 0;

    public StatusCodeFilter(long code) {
        this.min = code;
        this.max = code;
    }

    public StatusCodeFilter(long mincode, long maxcode) {
        min = mincode;
        max = maxcode;
    }

    private boolean matches(Page page) {

        long status = page.getStatusCode();

        if (status >= min && status <= max) {
            return true;
        }

        return false;
    }


    public boolean matches(Object item) {
        return item instanceof Page && matches((Page)item);
    }

    public void describeTo(Description description) {
        throw new UnsupportedOperationException();
    }
}




See more files for this project here

Tea Stats

Web log analyzer... Written in OO Perl, provides the usual host / page analysis. Can also do site graphing using graphviz, browser, os, worm and search engine identification, and country and session tracking.

Project homepage: http://sourceforge.net/projects/teastats
Programming language(s): Java
License: other

  MethodFilter.java
  QueryTermFilter.java
  RefererFilter.java
  StatusCodeFilter.java
  SuccessFilter.java