org.vladnput
Class VladConfig

java.lang.Object
  extended by org.vladnput.VladConfig

public class VladConfig
extends java.lang.Object

The main class for interfacing with the VladNput framework. Obtain an instance using VladConfig.parse(file) or VladConfig.parseResource(resourceName) and then use vladConfig.validate(request, null) to validate HTTP requests. This class is immutable and can be used safely from multiple threads without synchronization. References to it may also be published without synchronization on 1.5 JVMs and above.

Author:
Patrick Higgins

Field Summary
static java.lang.String SENSITIVE_VALUE
          The value that is put into VladError objects instead of the real value for parameters and types that are sensitive, e.g.
 
Method Summary
static VladConfig parse(java.io.File file)
          Parse a Vlad configuration from file.
static VladConfig parseResource(java.lang.String resourceName)
          Parse a Vlad configuration from resourceName.
 java.lang.String toString()
           
 VladErrors validate(javax.servlet.http.HttpServletRequest request, RequestCanonicalizer canonicalizer)
          Validates the request against this Vlad configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SENSITIVE_VALUE

public static final java.lang.String SENSITIVE_VALUE
The value that is put into VladError objects instead of the real value for parameters and types that are sensitive, e.g. passwords and credit cards.

See Also:
Constant Field Values
Method Detail

parseResource

public static VladConfig parseResource(java.lang.String resourceName)
                                throws java.io.IOException,
                                       ParseException
Parse a Vlad configuration from resourceName.

Parameters:
resourceName - Vlad configuration resource
Returns:
Vlad configuration
Throws:
java.io.IOException - If there is a problem reading file
ParseException - If there is a problem parsing file

parse

public static VladConfig parse(java.io.File file)
                        throws java.io.IOException,
                               ParseException
Parse a Vlad configuration from file.

Parameters:
file - Vlad configuration file
Returns:
Vlad configuration
Throws:
java.io.IOException - If there is a problem reading file
ParseException - If there is a problem parsing file

validate

public VladErrors validate(javax.servlet.http.HttpServletRequest request,
                           RequestCanonicalizer canonicalizer)
Validates the request against this Vlad configuration. If the request URL or parameter names require special semantics such as case-insensitivity or an environment-specific prefix to be stripped, then a canonicalizer should be supplied. If one is not given, then the URL used will be request.getRequestURI() and parameter names will be used as returned by request.getParameterNames().

Parameters:
request - The request to validate
canonicalizer - Canonicalizer for the request path and parameters. May be null.
Returns:
All validation errors

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009 Patrick Higgins. All Rights Reserved.