Package hudson.util
Class FormValidation.URLCheck
- java.lang.Object
-
- hudson.util.FormValidation.URLCheck
-
- Enclosing class:
- FormValidation
public abstract static class FormValidation.URLCheck extends Object
Convenient base class for checking the validity of URLs.This allows the check method to call various utility methods in a concise syntax.
-
-
Constructor Summary
Constructors Constructor Description URLCheck()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract FormValidation
check()
Implement the actual form validation logic, by using other convenience methods defined in this class.protected boolean
findText(BufferedReader in, String literal)
Finds the string literal from the given reader.protected FormValidation
handleIOException(String url, IOException e)
Calls theFormValidation.error(String)
method with a reasonable error message.protected BufferedReader
open(URL url)
Opens the given URL and reads text content from it.
-
-
-
Method Detail
-
open
protected BufferedReader open(URL url) throws IOException
Opens the given URL and reads text content from it. This method honors Content-type header.- Throws:
IOException
-
findText
protected boolean findText(BufferedReader in, String literal) throws IOException
Finds the string literal from the given reader.- Returns:
- true if found, false otherwise.
- Throws:
IOException
-
handleIOException
protected FormValidation handleIOException(String url, IOException e) throws IOException, javax.servlet.ServletException
Calls theFormValidation.error(String)
method with a reasonable error message. Use this method when theopen(URL)
orfindText(BufferedReader, String)
fails.- Parameters:
url
- Pass in the URL that was connected. Used for error diagnosis.- Throws:
IOException
javax.servlet.ServletException
-
check
protected abstract FormValidation check() throws IOException, javax.servlet.ServletException
Implement the actual form validation logic, by using other convenience methods defined in this class. If you are not using any of those, you don't need to extend from this class.- Throws:
IOException
javax.servlet.ServletException
-
-