hudson.util
Class FormFieldValidator

java.lang.Object
  extended by hudson.util.FormFieldValidator
Direct Known Subclasses:
FormFieldValidator.Base64, FormFieldValidator.Executable, FormFieldValidator.NonNegativeInteger, FormFieldValidator.URLCheck, FormFieldValidator.WorkspaceFileMask, FormFieldValidator.WorkspaceFilePath

Deprecated. as of 1.294 Use FormValidation as a return value in your check method.

public abstract class FormFieldValidator
extends Object

Base class that provides the framework for doing on-the-fly form field validation.

The check() method is to be implemented by derived classes to perform the validation. See hudson-behavior.js 'validated' CSS class and 'checkUrl' attribute.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class FormFieldValidator.Base64
          Deprecated. as of 1.305 Use FormValidation.validateBase64(String, boolean, boolean, String) instead.
static class FormFieldValidator.Executable
          Deprecated. as of 1.294. Use FormValidation.validateExecutable(String)
static class FormFieldValidator.HudsonURL
          Deprecated. Checks if the given value is an URL to some Hudson's top page.
static class FormFieldValidator.NonNegativeInteger
          Deprecated. as of 1.294 Use FormValidation.validateNonNegativeInteger(String)
static class FormFieldValidator.URLCheck
          Deprecated. as of 1.294 Use FormValidation.URLCheck
static class FormFieldValidator.WorkspaceDirectory
          Deprecated. as of 1.294. Use FilePath.validateRelativeDirectory(String, boolean) (see javadoc plugin for the example)
static class FormFieldValidator.WorkspaceFileMask
          Deprecated. as of 1.294. Use FilePath.validateFileMask(String, boolean)
static class FormFieldValidator.WorkspaceFilePath
          Deprecated. as of 1.294. Use FilePath.validateRelativePath(String, boolean, boolean)
 
Field Summary
static Permission CHECK
          Deprecated.  
protected  Permission permission
          Deprecated. Permission to check, or null if this check doesn't require any permission.
protected  org.kohsuke.stapler.StaplerRequest request
          Deprecated.  
protected  org.kohsuke.stapler.StaplerResponse response
          Deprecated.  
protected  AccessControlled subject
          Deprecated. The object to which the permission is checked against.
 
Constructor Summary
protected FormFieldValidator(AccessControlled subject, Permission permission)
          Deprecated.  
protected FormFieldValidator(Permission permission)
          Deprecated.  
protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, AccessControlled subject, Permission permission)
          Deprecated. Use FormFieldValidator(AccessControlled,Permission) and remove StaplerRequest and StaplerResponse from your "doCheck..." method parameter
protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, boolean adminOnly)
          Deprecated.  
protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, Permission permission)
          Deprecated. Use FormFieldValidator(Permission) and remove StaplerRequest and StaplerResponse from your "doCheck..." method parameter
 
Method Summary
protected abstract  void check()
          Deprecated.  
 void error(String message)
          Deprecated. Sends out a string error message that indicates an error.
 void error(String format, Object... args)
          Deprecated. Sends out a string error message that indicates an error, by formatting it with String.format(String, Object[])
 void errorWithMarkup(String message)
          Deprecated. Sends out an HTML fragment that indicates an error.
protected  File getFileParameter(String paramName)
          Deprecated. Gets the parameter as a file.
 void ok()
          Deprecated. Sends out an HTML fragment that indicates a success.
 void ok(String message)
          Deprecated.  
 void ok(String format, Object... args)
          Deprecated.  
 void okWithMarkup(String message)
          Deprecated.  
 void process()
          Deprecated. Runs the validation code.
 void respond(String html)
          Deprecated. Sends out an arbitrary HTML fragment.
 void warning(String message)
          Deprecated.  
 void warning(String format, Object... args)
          Deprecated.  
 void warningWithMarkup(String message)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK

public static final Permission CHECK
Deprecated. 

request

protected final org.kohsuke.stapler.StaplerRequest request
Deprecated. 

response

protected final org.kohsuke.stapler.StaplerResponse response
Deprecated. 

permission

protected final Permission permission
Deprecated. 
Permission to check, or null if this check doesn't require any permission.


subject

protected final AccessControlled subject
Deprecated. 
The object to which the permission is checked against. If permission is non-null, must be non-null.

Constructor Detail

FormFieldValidator

protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request,
                             org.kohsuke.stapler.StaplerResponse response,
                             boolean adminOnly)
Deprecated. 
Parameters:
adminOnly - Pass true to only let admin users to run the check. This is necessary for security reason, so that unauthenticated user cannot obtain sensitive information or run a process that may have side-effect.

FormFieldValidator

protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request,
                             org.kohsuke.stapler.StaplerResponse response,
                             Permission permission)
Deprecated. Use FormFieldValidator(Permission) and remove StaplerRequest and StaplerResponse from your "doCheck..." method parameter


FormFieldValidator

protected FormFieldValidator(Permission permission)
Deprecated. 
Parameters:
permission - Permission needed to perform this validation, or null if no permission is necessary.

FormFieldValidator

protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request,
                             org.kohsuke.stapler.StaplerResponse response,
                             AccessControlled subject,
                             Permission permission)
Deprecated. Use FormFieldValidator(AccessControlled,Permission) and remove StaplerRequest and StaplerResponse from your "doCheck..." method parameter


FormFieldValidator

protected FormFieldValidator(AccessControlled subject,
                             Permission permission)
Deprecated. 
Method Detail

process

public final void process()
                   throws IOException,
                          javax.servlet.ServletException
Deprecated. 
Runs the validation code.

Throws:
IOException
javax.servlet.ServletException

check

protected abstract void check()
                       throws IOException,
                              javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

getFileParameter

protected final File getFileParameter(String paramName)
Deprecated. 
Gets the parameter as a file.


ok

public void ok()
        throws IOException,
               javax.servlet.ServletException
Deprecated. 
Sends out an HTML fragment that indicates a success.

Throws:
IOException
javax.servlet.ServletException

respond

public void respond(String html)
             throws IOException,
                    javax.servlet.ServletException
Deprecated. 
Sends out an arbitrary HTML fragment.

Throws:
IOException
javax.servlet.ServletException

error

public void error(String message)
           throws IOException,
                  javax.servlet.ServletException
Deprecated. 
Sends out a string error message that indicates an error.

Parameters:
message - Human readable message to be sent. error(null) can be used as ok().
Throws:
IOException
javax.servlet.ServletException

warning

public void warning(String message)
             throws IOException,
                    javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

ok

public void ok(String message)
        throws IOException,
               javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

error

public void error(String format,
                  Object... args)
           throws IOException,
                  javax.servlet.ServletException
Deprecated. 
Sends out a string error message that indicates an error, by formatting it with String.format(String, Object[])

Throws:
IOException
javax.servlet.ServletException

warning

public void warning(String format,
                    Object... args)
             throws IOException,
                    javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

ok

public void ok(String format,
               Object... args)
        throws IOException,
               javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

errorWithMarkup

public void errorWithMarkup(String message)
                     throws IOException,
                            javax.servlet.ServletException
Deprecated. 
Sends out an HTML fragment that indicates an error.

This method must be used with care to avoid cross-site scripting attack.

Parameters:
message - Human readable message to be sent. error(null) can be used as ok().
Throws:
IOException
javax.servlet.ServletException

warningWithMarkup

public void warningWithMarkup(String message)
                       throws IOException,
                              javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException

okWithMarkup

public void okWithMarkup(String message)
                  throws IOException,
                         javax.servlet.ServletException
Deprecated. 
Throws:
IOException
javax.servlet.ServletException


Copyright © 2004-2013. All Rights Reserved.