[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HV-499) Add @URI validator to support relative URLs

Ted Bergeron (JIRA) noreply at atlassian.com
Fri Mar 16 15:40:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HV-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45996#comment-45996 ] 

Ted Bergeron edited comment on HV-499 at 3/16/12 2:39 PM:
----------------------------------------------------------

http://docs.oracle.com/javase/6/docs/api/java/net/URI.html

The simple explanation is just a path, with http in mind.  The relative URI for this page is: /browse/HV-499.

I think the simplest implementation is:
{code}
String stringURI = "/browse/HV-499";
try {
    new URI(stringURI);
    // Valid
} catch (URISyntaxException e) {
    // Invalid
}
{code}

Here's one in JavaScript that uses regular expressions:  http://www.456bereastreet.com/archive/201105/validate_url_syntax_with_javascript/





      was (Author: tedberg):
    http://docs.oracle.com/javase/6/docs/api/java/net/URI.html

The simple explanation is just a path, with http in mind.  The relative URI for this page is: /browse/HV-499.

I think the simplest implementation is:
{code}
String stringURI = "/browse/HV-499";
try {
    new URI(stringURI);
    // Valid
} catch (URISyntaxException e) {
    // Invalid
}
{code}


  
> Add @URI validator to support relative URLs
> -------------------------------------------
>
>                 Key: HV-499
>                 URL: https://hibernate.onjira.com/browse/HV-499
>             Project: Hibernate Validator
>          Issue Type: New Feature
>          Components: validators
>    Affects Versions: 4.2.0.Final
>            Reporter: Ted Bergeron
>
> Should be trivial to leverage the @URL logic to allow for relative URI's.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list