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

Gunnar Morling (JIRA) noreply at atlassian.com
Wed Apr 11 04:04:49 EDT 2012


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

Gunnar Morling commented on HV-499:
-----------------------------------

I think {{@URI}} and relative URLs are different kinds of things, probably we should handle them separately.

AFAIK relative URLs are only valid within the context of another URL, see we might add an attribute {{context()}} to {{@URL}} which specifies this context. We then could use the [URL(URL context, String spec)|http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#URL(java.net.URL,%20java.lang.String)] constructor for validation (I think that's what you suggested to use {{protocol}} for).

On the other hand I think one would always need an additional regular expression to specify the structure of the relative URL and I'm wondering what one actually gains by applying the {{@URL}} constraint to relative URLs at all? Maybe a simple {{@Pattern}} would suffice?

> 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