Package hudson.util
Class FormFieldValidator
- java.lang.Object
-
- hudson.util.FormFieldValidator
-
- Direct Known Subclasses:
FormFieldValidator.Base64,FormFieldValidator.Executable,FormFieldValidator.NonNegativeInteger,FormFieldValidator.URLCheck,FormFieldValidator.WorkspaceFileMask,FormFieldValidator.WorkspaceFilePath
@Deprecated public abstract class FormFieldValidator extends Object
Deprecated.as of 1.294 UseFormValidationas a return value in your check method.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
Nested Classes Modifier and Type Class Description static classFormFieldValidator.Base64Deprecated.as of 1.305 UseFormValidation.validateBase64(String, boolean, boolean, String)instead.static classFormFieldValidator.ExecutableDeprecated.as of 1.294.static classFormFieldValidator.HudsonURLDeprecated.Checks if the given value is an URL to some Hudson's top page.static classFormFieldValidator.NonNegativeIntegerDeprecated.as of 1.294 UseFormValidation.validateNonNegativeInteger(String)static classFormFieldValidator.URLCheckDeprecated.as of 1.294 UseFormValidation.URLCheckstatic classFormFieldValidator.WorkspaceDirectoryDeprecated.as of 1.294.static classFormFieldValidator.WorkspaceFileMaskDeprecated.as of 1.294.static classFormFieldValidator.WorkspaceFilePathDeprecated.as of 1.294.
-
Field Summary
Fields Modifier and Type Field Description static PermissionCHECKDeprecated.protected PermissionpermissionDeprecated.Permission to check, or null if this check doesn't require any permission.protected org.kohsuke.stapler.StaplerRequestrequestDeprecated.protected org.kohsuke.stapler.StaplerResponseresponseDeprecated.protected AccessControlledsubjectDeprecated.The object to which the permission is checked against.
-
Constructor Summary
Constructors Modifier Constructor Description protectedFormFieldValidator(AccessControlled subject, Permission permission)Deprecated.protectedFormFieldValidator(Permission permission)Deprecated.protectedFormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, boolean adminOnly)Deprecated.protectedFormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, AccessControlled subject, Permission permission)Deprecated.UseFormFieldValidator(AccessControlled,Permission)and removeStaplerRequestandStaplerResponsefrom your "doCheck..." method parameterprotectedFormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, Permission permission)Deprecated.UseFormFieldValidator(Permission)and removeStaplerRequestandStaplerResponsefrom your "doCheck..." method parameter
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract voidcheck()Deprecated.voiderror(String message)Deprecated.Sends out a string error message that indicates an error.voiderror(String format, Object... args)Deprecated.Sends out a string error message that indicates an error, by formatting it withString.format(String, Object[])voiderrorWithMarkup(String message)Deprecated.Sends out an HTML fragment that indicates an error.protected FilegetFileParameter(String paramName)Deprecated.Gets the parameter as a file.voidok()Deprecated.Sends out an HTML fragment that indicates a success.voidok(String message)Deprecated.voidok(String format, Object... args)Deprecated.voidokWithMarkup(String message)Deprecated.voidprocess()Deprecated.Runs the validation code.voidrespond(String html)Deprecated.Sends out an arbitrary HTML fragment.voidwarning(String message)Deprecated.voidwarning(String format, Object... args)Deprecated.voidwarningWithMarkup(String message)Deprecated.
-
-
-
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. Ifpermissionis 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
@Deprecated protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, Permission permission)
Deprecated.UseFormFieldValidator(Permission)and removeStaplerRequestandStaplerResponsefrom 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
@Deprecated protected FormFieldValidator(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, AccessControlled subject, Permission permission)
Deprecated.UseFormFieldValidator(AccessControlled,Permission)and removeStaplerRequestandStaplerResponsefrom your "doCheck..." method parameter
-
FormFieldValidator
protected FormFieldValidator(AccessControlled subject, Permission permission)
Deprecated.
-
-
Method Detail
-
process
public final void process() throws IOException, javax.servlet.ServletExceptionDeprecated.Runs the validation code.- Throws:
IOExceptionjavax.servlet.ServletException
-
check
protected abstract void check() throws IOException, javax.servlet.ServletExceptionDeprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
getFileParameter
protected final File getFileParameter(String paramName)
Deprecated.Gets the parameter as a file.
-
ok
public void ok() throws IOException, javax.servlet.ServletExceptionDeprecated.Sends out an HTML fragment that indicates a success.- Throws:
IOExceptionjavax.servlet.ServletException
-
respond
public void respond(String html) throws IOException, javax.servlet.ServletException
Deprecated.Sends out an arbitrary HTML fragment.- Throws:
IOExceptionjavax.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 asok().- Throws:
IOExceptionjavax.servlet.ServletException
-
warning
public void warning(String message) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
ok
public void ok(String message) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.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 withString.format(String, Object[])- Throws:
IOExceptionjavax.servlet.ServletException
-
warning
public void warning(String format, Object... args) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
ok
public void ok(String format, Object... args) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.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 asok().- Throws:
IOExceptionjavax.servlet.ServletException
-
warningWithMarkup
public void warningWithMarkup(String message) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
okWithMarkup
public void okWithMarkup(String message) throws IOException, javax.servlet.ServletException
Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
-