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

Hardy Ferentschik (JIRA) noreply at atlassian.com
Tue Apr 10 14:08:48 EDT 2012


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

Hardy Ferentschik commented on HV-499:
--------------------------------------

Just throwing our some ideas:

* Obviously we could create an _ at URI_ constraint. However, the URI constructor (as well as the URL constructor) are only applying very weak validation of the URL/URI. A _ at URI_ constraint would for that reason also require a regexp part
* An alternative is to "allow" relative URLs w/ the _ at URL_ constraint. I think this can be achieved while staying backwards compatible. In this case you would have to specify, however, at least the protocal, eg _ at URL(protocol="http")_. See also - https://github.com/hferentschik/hibernate-validator/commit/acaddf789c284dbf4da23c60e8d01da00e600d79
* Yet another (backwards compatible) solution could be to add a _regexpOnly_ flag which is defaulted to _false_. If set to _true_ the validation only uses regular expression. Of course this requires that the user specifies a regexp which works for example for absolute and relative URLs.

Independent from _ at URI_ and _ at URL_ is there a need for something like _ at Path_ and/or _ at File_?

WDYT? 

> 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
>             Fix For: 4.3.0.CR1
>
>
> 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