org.apache.commons.latka.validators
Class ResponseHeaderValidator

java.lang.Object
  |
  +--org.apache.commons.latka.validators.BaseValidator
        |
        +--org.apache.commons.latka.validators.ResponseHeaderValidator
All Implemented Interfaces:
Validator

public class ResponseHeaderValidator
extends BaseValidator
implements Validator

ResponseHeaderValidator validates response headers in an HTTP session.

Author:
Morgan Delagrange

Constructor Summary
ResponseHeaderValidator(java.lang.String headerName)
          Constructs a validator for the given header with no label.
ResponseHeaderValidator(java.lang.String label, java.lang.String headerName)
          Constructs a labeled validator for the given header
 
Method Summary
 void setHeaderValue(java.lang.String headerValue)
          Sets the desired value of the header to be validated.
 void validate(Response response)
          Checks to see that the header exists, and also checks its value if setHeaderValue(String) has been called
 
Methods inherited from class org.apache.commons.latka.validators.BaseValidator
getLabel, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseHeaderValidator

public ResponseHeaderValidator(java.lang.String headerName)
Constructs a validator for the given header with no label.
Parameters:
headerName - Name of the header to validate

ResponseHeaderValidator

public ResponseHeaderValidator(java.lang.String label,
                               java.lang.String headerName)
Constructs a labeled validator for the given header
Parameters:
label - name of the header to validate
headerName -  
Method Detail

setHeaderValue

public void setHeaderValue(java.lang.String headerValue)
Sets the desired value of the header to be validated. If this method is not called, then the validator will only check for the existence of the header and disregard its value.
Parameters:
headerValue - desired value of the header, or null to look for a header with the String value "null"

validate

public void validate(Response response)
              throws ValidationException
Checks to see that the header exists, and also checks its value if setHeaderValue(String) has been called
Specified by:
validate in interface Validator
Overrides:
validate in class BaseValidator
Parameters:
response - The HTTP response to validate
Throws:
ValidationException - if the header does not meet the criteria of the test


Copyright © 2001 Apache Software Foundation. Documenation generated September 13 2001.