Package hudson.util
Class FormValidation.URLCheck
java.lang.Object
hudson.util.FormValidation.URLCheck
- Enclosing class:
- FormValidation
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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) Deprecated.protected boolean
Find the string literal from the given stream of lines.protected FormValidation
handleIOException
(String url, IOException e) Calls theFormValidation.error(String)
method with a reasonable error message.Open the given URI and read text content from it.protected BufferedReader
Deprecated.useopen(URI)
-
Constructor Details
-
URLCheck
public URLCheck()
-
-
Method Details
-
open
Open the given URI and read text content from it. This method honors the Content-type header.- Throws:
IOException
- if the URI scheme is not supported, the connection was interrupted, or the response was an error- Since:
- 2.382
-
open
Deprecated.useopen(URI)
Opens the given URL and reads text content from it. This method honors Content-type header.- Throws:
IOException
-
findText
Find the string literal from the given stream of lines.- Returns:
- true if found, false otherwise
- Since:
- 2.382
-
findText
Deprecated.Finds the string literal from the given reader.- Returns:
- true if found, false otherwise.
- Throws:
IOException
-
handleIOException
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
-
check
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
-
findText(Stream, String)