[
https://hibernate.onjira.com/browse/HV-499?page=com.atlassian.jira.plugin...
]
Hardy Ferentschik edited comment on HV-499 at 4/10/12 1:09 PM:
---------------------------------------------------------------
Throwing our some ideas:
* Obviously we could create an _@URI_ constraint. However, the URI constructor (as well as
the URL constructor) are only applying very weak validation of the URL/URI. A _@URI_
constraint would for that reason also require a regexp part
* An alternative is to "allow" relative URLs w/ the _@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 _@URL(protocol="http")_. See also -
https://github.com/hferentschik/hibernate-validator/commit/acaddf789c284d...
* 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 _@URI_ and _@URL_ is there a need for something like _@Path_ and/or
_@File_?
WDYT?
was (Author: hardy.ferentschik):
Just throwing our some ideas:
* Obviously we could create an _@URI_ constraint. However, the URI constructor (as well as
the URL constructor) are only applying very weak validation of the URL/URI. A _@URI_
constraint would for that reason also require a regexp part
* An alternative is to "allow" relative URLs w/ the _@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 _@URL(protocol="http")_. See also -
https://github.com/hferentschik/hibernate-validator/commit/acaddf789c284d...
* 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 _@URI_ and _@URL_ is there a need for something like _@Path_ and/or
_@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