RE: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

fabf
Hi Bruno,

     Thanks for your comments ! Does relevant forrest documentation patch
and example addition have to be applied against sandbox as well or directly
against its respective path ?

Best regards,
Fabian

>From: "Bruno Aranda (JIRA)" <[hidden email]>
>To: [hidden email]
>Subject: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based
>on emailvalidator
>Date: Mon, 1 Aug 2005 19:27:36 +0200 (CEST)
>
>     [
>http://issues.apache.org/jira/browse/MYFACES-372?page=comments#action_12317360 
>]
>
>Bruno Aranda commented on MYFACES-372:
>--------------------------------------
>
>I've applied your patch to the sandbox (after making some adaptations of
>the validator to the current svn state). Now, it would be wonderful if you
>could also provide an example and some documentation in order that the
>myfaces team and the community can evaluate the validator. Thanks for the
>contribution!
>
> > url validator tag / tomahawk based on emailvalidator
> > ----------------------------------------------------
> >
> >          Key: MYFACES-372
> >          URL: http://issues.apache.org/jira/browse/MYFACES-372
> >      Project: MyFaces
> >         Type: New Feature
> >   Components: Sandbox
> >     Versions: Nightly Build
> >  Environment: windows
> >     Reporter: Fabian Frederick
> >     Priority: Trivial
> >  Attachments: myfacesff2.diff
> >
> > Index: tomahawk/tld/myfaces_ext.tld
> > ===================================================================
> > --- tomahawk/tld/myfaces_ext.tld (revision 225811)
> > +++ tomahawk/tld/myfaces_ext.tld (working copy)
> > @@ -2381,6 +2381,15 @@
> >   A custom validator for email address format, based upons Jakarta
>Commons.
> >          </description>
> >   </tag>
> > +    <!-- Validator for Url -->
> > +     <tag>
> > +        <name>validateUrl</name>
> > +        
><tag-class>org.apache.myfaces.custom.emailvalidator.ValidateUrlTag</tag-class>
> > +        <body-content>JSP</body-content>
> > +        <description>
> > + A custom validator for url format, based upons Jakarta Commons.
> > +        </description>
> > + </tag>
> >      <!-- Validator for ISBN -->
> >       <!--tag>
> > Index: tomahawk/conf/faces-config.xml
> > ===================================================================
> > --- tomahawk/conf/faces-config.xml (revision 225811)
> > +++ tomahawk/conf/faces-config.xml (working copy)
> > @@ -720,6 +720,11 @@
> >   </validator>
> >   <validator>
> > + <validator-id>org.apache.myfaces.validator.Url</validator-id>
> >
>+ <validator-class>org.apache.myfaces.custom.urlvalidator.UrlValidator</validator-class>
> > + </validator>
> > +
> > + <validator>
> >   <validator-id>org.apache.myfaces.validator.Equal</validator-id>
> >  
> <validator-class>org.apache.myfaces.custom.equalvalidator.EqualValidator</validator-class>
> >   </validator>
> > Index:
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java
> > ===================================================================
> > ---
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java (revision
>0)
> > +++
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java (revision
>0)
> > @@ -0,0 +1,54 @@
> > +package org.apache.myfaces.custom.urlvalidator;
> > +
> > +import org.apache.myfaces.util.MessageUtils;
> > +
> > +import org.apache.commons.validator.GenericValidator;
> > +
> > +import javax.faces.application.FacesMessage;
> > +import javax.faces.component.UIComponent;
> > +import javax.faces.context.FacesContext;
> > +import javax.faces.validator.Validator;
> > +import javax.faces.validator.ValidatorException;
> > +
> > +public class UrlValidator implements Validator {
> > +
> > + /**
> > + * <p>The standard converter id for this converter.</p>
> > + */
> > + public static final String VALIDATOR_ID   =
>"org.apache.myfaces.validator.Url";
> > + /**
> > + * <p>The message identifier of the {@link FacesMessage} to be created
>if
> > + * the maximum length check fails.</p>
> > + */
> > + public static final String URL_MESSAGE_ID =
>"org.apache.myfaces.Url.INVALID";
> > +
> > + public UrlValidator(){
> > + }
> > +
> > + /**
> > + * method that validates an url address.
> > + * it uses the commons-validator
> > + */
> > + public void validate(
> > + FacesContext facesContext,
> > + UIComponent uiComponent,
> > + Object value)
> > + throws ValidatorException {
> > +
> > +
> > + if (facesContext == null) throw new
>NullPointerException("facesContext");
> > + if (uiComponent == null) throw new
>NullPointerException("uiComponent");
> > +
> > + if (value == null)
> > + {
> > + return;
> > + }
> > + if (!GenericValidator.isUrl(value.toString())) {
> > + Object[] args = {value.toString()};
> > + throw new
>ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,URL_MESSAGE_ID,
>args));
> > +
> > + }
> > +
> > + }
> > +
> > +}
> > Index:
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java
> > ===================================================================
> > ---
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java (revision
>0)
> > +++
>tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java (revision
>0)
> > @@ -0,0 +1,27 @@
> > +package org.apache.myfaces.custom.urlvalidator;
> > +
> > +import javax.faces.validator.Validator;
> > +import javax.faces.webapp.ValidatorTag;
> > +import javax.servlet.jsp.JspException;
> > +
> > +public class ValidateUrlTag extends ValidatorTag
> > +{
> > +  private static final long serialVersionUID = 6041422002721046221L;
> > +
> > +  public ValidateUrlTag()
> > +    {
> > + }
> > +
> > + protected Validator createValidator() throws JspException
> > +    {
> > + setValidatorId(UrlValidator.VALIDATOR_ID);
> > +    UrlValidator validator = (UrlValidator)super.createValidator();
> > + return validator;
> > + }
> > +
> > +    public void release()
> > +    {
> > +        super.release();
> > +    }
> > +
> > +}</textarea>
> >                     </td>
> >     </tr>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >     <tr><td colspan=2 bgcolor=ffffff>&nbsp;
> >     <style>
> >     <!--
> >     .fieldLabelArea
> >     {
> >         width: 30%;
> >     }
> >     -->
> >     </style>
> >     </td></tr>
> >     <tr><td colspan=2 bgcolor=f0f0f0>
> >         <b>Comment</b>: (an optional comment describing this update)
> >     </td></tr>
> >
> >
> > <tr
> >
> >
> >     >
> >
> >
> >
> >
> > <td class="fieldLabelArea">
> >
> >
> >
> >
> >
> > Update comment:
> >
> >
> > </td>
> >
> >
> > <td bgcolor="ffffff" nowrap class="fieldValueArea">
> > <textarea name="comment"
> >           cols="70"
> >           rows="4"
> >           wrap="virtual"
> >
> >
> >             style="width:90%"
> >
> >
> >
> >
> >
> >             accesskey="m"
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > >
>
>--
>This message is automatically generated by JIRA.
>-
>If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
>-
>For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
>


Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

Bruno Aranda
You should create a svn diff against forrest for the forrest
documentation, and a diff against the examples for the validator
example. Step by step procedure, that will clear any doubt :-)

1. Download svn 'current' sources
2. Create your forrest documentation in the 'forrest' subproject.
3. Create the example in the 'examples' subproject, sandbox folder.
You could create another jsp page that use your component and add also
an entry to the home.jsp.
4. Add every new file with svn (e.g. 'svn add
examples/sandbox/urlvalidator.jsp'), so the patch will know that this
is a new file and it will include it.
5. Create two patches from the current folder, one for forrest ('svn
diff forrest') and another one for the examples ('svn diff examples').
6. And finally, submit the patches! :-)

Thanks, documentation is essential...

Regards,

Bruno

2005/8/2, Fab Psycho <[hidden email]>:

> Hi Bruno,
>
>      Thanks for your comments ! Does relevant forrest documentation patch
> and example addition have to be applied against sandbox as well or directly
> against its respective path ?
>
> Best regards,
> Fabian
>
> >From: "Bruno Aranda (JIRA)" <[hidden email]>
> >To: [hidden email]
> >Subject: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based
> >on emailvalidator
> >Date: Mon, 1 Aug 2005 19:27:36 +0200 (CEST)
> >
> >     [
> >http://issues.apache.org/jira/browse/MYFACES-372?page=comments#action_12317360
> >]
> >
> >Bruno Aranda commented on MYFACES-372:
> >--------------------------------------
> >
> >I've applied your patch to the sandbox (after making some adaptations of
> >the validator to the current svn state). Now, it would be wonderful if you
> >could also provide an example and some documentation in order that the
> >myfaces team and the community can evaluate the validator. Thanks for the
> >contribution!
> >
> > > url validator tag / tomahawk based on emailvalidator
> > > ----------------------------------------------------
> > >
> > >          Key: MYFACES-372
> > >          URL: http://issues.apache.org/jira/browse/MYFACES-372
> > >      Project: MyFaces
> > >         Type: New Feature
> > >   Components: Sandbox
> > >     Versions: Nightly Build
> > >  Environment: windows
> > >     Reporter: Fabian Frederick
> > >     Priority: Trivial
> > >  Attachments: myfacesff2.diff
> > >
> > > Index: tomahawk/tld/myfaces_ext.tld
> > > ===================================================================
> > > --- tomahawk/tld/myfaces_ext.tld    (revision 225811)
> > > +++ tomahawk/tld/myfaces_ext.tld    (working copy)
> > > @@ -2381,6 +2381,15 @@
> > >                     A custom validator for email address format, based upons Jakarta
> >Commons.
> > >          </description>
> > >     </tag>
> > > +    <!-- Validator for Url -->
> > > +     <tag>
> > > +        <name>validateUrl</name>
> > > +
> ><tag-class>org.apache.myfaces.custom.emailvalidator.ValidateUrlTag</tag-class>
> > > +        <body-content>JSP</body-content>
> > > +        <description>
> > > +                   A custom validator for url format, based upons Jakarta Commons.
> > > +        </description>
> > > +   </tag>
> > >      <!-- Validator for ISBN -->
> > >       <!--tag>
> > > Index: tomahawk/conf/faces-config.xml
> > > ===================================================================
> > > --- tomahawk/conf/faces-config.xml  (revision 225811)
> > > +++ tomahawk/conf/faces-config.xml  (working copy)
> > > @@ -720,6 +720,11 @@
> > >     </validator>
> > >     <validator>
> > > +           <validator-id>org.apache.myfaces.validator.Url</validator-id>
> > >
> >+              <validator-class>org.apache.myfaces.custom.urlvalidator.UrlValidator</validator-class>
> > > +   </validator>
> > > +
> > > +   <validator>
> > >             <validator-id>org.apache.myfaces.validator.Equal</validator-id>
> > >
> >               <validator-class>org.apache.myfaces.custom.equalvalidator.EqualValidator</validator-class>
> > >     </validator>
> > > Index:
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java
> > > ===================================================================
> > > ---
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java     (revision
> >0)
> > > +++
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java     (revision
> >0)
> > > @@ -0,0 +1,54 @@
> > > +package org.apache.myfaces.custom.urlvalidator;
> > > +
> > > +import org.apache.myfaces.util.MessageUtils;
> > > +
> > > +import org.apache.commons.validator.GenericValidator;
> > > +
> > > +import javax.faces.application.FacesMessage;
> > > +import javax.faces.component.UIComponent;
> > > +import javax.faces.context.FacesContext;
> > > +import javax.faces.validator.Validator;
> > > +import javax.faces.validator.ValidatorException;
> > > +
> > > +public class UrlValidator implements Validator {
> > > +
> > > +   /**
> > > +    * <p>The standard converter id for this converter.</p>
> > > +    */
> > > +   public static final String      VALIDATOR_ID       =
> >"org.apache.myfaces.validator.Url";
> > > +   /**
> > > +    * <p>The message identifier of the {@link FacesMessage} to be created
> >if
> > > +    * the maximum length check fails.</p>
> > > +    */
> > > +   public static final String URL_MESSAGE_ID =
> >"org.apache.myfaces.Url.INVALID";
> > > +
> > > +   public UrlValidator(){
> > > +   }
> > > +
> > > +   /**
> > > +    * method that validates an url address.
> > > +    * it uses the commons-validator
> > > +    */
> > > +   public void validate(
> > > +           FacesContext facesContext,
> > > +           UIComponent uiComponent,
> > > +           Object value)
> > > +           throws ValidatorException {
> > > +
> > > +
> > > +                   if (facesContext == null) throw new
> >NullPointerException("facesContext");
> > > +                   if (uiComponent == null) throw new
> >NullPointerException("uiComponent");
> > > +
> > > +                   if (value == null)
> > > +                   {
> > > +                           return;
> > > +                   }
> > > +                   if (!GenericValidator.isUrl(value.toString())) {
> > > +                           Object[] args = {value.toString()};
> > > +                           throw new
> >ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,URL_MESSAGE_ID,
> >args));
> > > +
> > > +                   }
> > > +
> > > +   }
> > > +
> > > +}
> > > Index:
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java
> > > ===================================================================
> > > ---
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java   (revision
> >0)
> > > +++
> >tomahawk/src/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java   (revision
> >0)
> > > @@ -0,0 +1,27 @@
> > > +package org.apache.myfaces.custom.urlvalidator;
> > > +
> > > +import javax.faces.validator.Validator;
> > > +import javax.faces.webapp.ValidatorTag;
> > > +import javax.servlet.jsp.JspException;
> > > +
> > > +public class ValidateUrlTag extends ValidatorTag
> > > +{
> > > +  private static final long serialVersionUID = 6041422002721046221L;
> > > +
> > > +  public ValidateUrlTag()
> > > +    {
> > > +   }
> > > +
> > > +   protected Validator createValidator() throws JspException
> > > +    {
> > > +           setValidatorId(UrlValidator.VALIDATOR_ID);
> > > +       UrlValidator validator = (UrlValidator)super.createValidator();
> > > +           return validator;
> > > +   }
> > > +
> > > +    public void release()
> > > +    {
> > > +        super.release();
> > > +    }
> > > +
> > > +}</textarea>
> > >                     </td>
> > >     </tr>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >     <tr><td colspan=2 bgcolor=ffffff>
> > >     <style>
> > >     <!--
> > >     .fieldLabelArea
> > >     {
> > >         width: 30%;
> > >     }
> > >     -->
> > >     </style>
> > >     </td></tr>
> > >     <tr><td colspan=2 bgcolor=f0f0f0>
> > >         <b>Comment</b>: (an optional comment describing this update)
> > >     </td></tr>
> > >
> > >
> > >     <tr
> > >
> > >
> > >     >
> > >
> > >
> > >
> > >
> > >                             <td class="fieldLabelArea">
> > >
> > >
> > >
> > >
> > >
> > >             Update comment:
> > >
> > >
> > >             </td>
> > >
> > >
> > >     <td bgcolor="ffffff" nowrap class="fieldValueArea">
> > > <textarea name="comment"
> > >           cols="70"
> > >           rows="4"
> > >           wrap="virtual"
> > >
> > >
> > >             style="width:90%"
> > >
> > >
> > >
> > >
> > >
> > >             accesskey="m"
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > >
> >
> >--
> >This message is automatically generated by JIRA.
> >-
> >If you think it was sent incorrectly contact one of the administrators:
> >    http://issues.apache.org/jira/secure/Administrators.jspa
> >-
> >For more information on JIRA, see:
> >    http://www.atlassian.com/software/jira
> >
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

schof-2
In reply to this post by fabf
Fabian,

Examples for sandbox components should go in the examples subproject.
Within that subproject is a directory for 'sandbox' so generate your
new example there.  Documentation goes in the forrest subproject.
There is also a special sandbox directory there as well.

Please do a test build of the site and examples to make sure that
everything compiles and looks good before supplying a patch.

Thanks for contributing to MyFaces.

sean

On 8/2/05, Fab Psycho <[hidden email]> wrote:
> Hi Bruno,
>
>      Thanks for your comments ! Does relevant forrest documentation patch
> and example addition have to be applied against sandbox as well or directly
> against its respective path ?
>
> Best regards,
> Fabian
Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

fabf
Sean,

    I'm working with eclipse and do the following :

     -go to svn repository
     -check out current as a project
     -go to java view.

My problem is project 'current' is declared as generic project and I don't
know how to change this  .... Wouldn't be interesting to place .project file
to support directly eclipse (or whatever plateform you preconize to work on
with myfaces).Or maybe there's a way to tell eclipse 'default builder is
build/build.xml and this svn import is java stuff' or something ?

PS:sorry for such trivial problem but I'm a java beginner :(

Best regards,
Fabian

>From: Sean Schofield <[hidden email]>
>Reply-To: Sean Schofield <[hidden email]>
>To: MyFaces Development <[hidden email]>
>Subject: Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk
>based on emailv
>Date: Tue, 2 Aug 2005 08:04:11 -0400
>
>Fabian,
>
>Examples for sandbox components should go in the examples subproject.
>Within that subproject is a directory for 'sandbox' so generate your
>new example there.  Documentation goes in the forrest subproject.
>There is also a special sandbox directory there as well.
>
>Please do a test build of the site and examples to make sure that
>everything compiles and looks good before supplying a patch.
>
>Thanks for contributing to MyFaces.
>
>sean
>
>On 8/2/05, Fab Psycho <[hidden email]> wrote:
> > Hi Bruno,
> >
> >      Thanks for your comments ! Does relevant forrest documentation
>patch
> > and example addition have to be applied against sandbox as well or
>directly
> > against its respective path ?
> >
> > Best regards,
> > Fabian


Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

schof-2
Can't help you with Eclipse as I use JBuilder.  Others here use it
though so they can probably help you.

sean

On 8/2/05, Fab Psycho <[hidden email]> wrote:

> Sean,
>
>     I'm working with eclipse and do the following :
>
>      -go to svn repository
>      -check out current as a project
>      -go to java view.
>
> My problem is project 'current' is declared as generic project and I don't
> know how to change this  .... Wouldn't be interesting to place .project file
> to support directly eclipse (or whatever plateform you preconize to work on
> with myfaces).Or maybe there's a way to tell eclipse 'default builder is
> build/build.xml and this svn import is java stuff' or something ?
>
> PS:sorry for such trivial problem but I'm a java beginner :(
>
> Best regards,
> Fabian
>
> >From: Sean Schofield <[hidden email]>
> >Reply-To: Sean Schofield <[hidden email]>
> >To: MyFaces Development <[hidden email]>
> >Subject: Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk
> >based on emailv
> >Date: Tue, 2 Aug 2005 08:04:11 -0400
> >
> >Fabian,
> >
> >Examples for sandbox components should go in the examples subproject.
> >Within that subproject is a directory for 'sandbox' so generate your
> >new example there.  Documentation goes in the forrest subproject.
> >There is also a special sandbox directory there as well.
> >
> >Please do a test build of the site and examples to make sure that
> >everything compiles and looks good before supplying a patch.
> >
> >Thanks for contributing to MyFaces.
> >
> >sean
> >
> >On 8/2/05, Fab Psycho <[hidden email]> wrote:
> > > Hi Bruno,
> > >
> > >      Thanks for your comments ! Does relevant forrest documentation
> >patch
> > > and example addition have to be applied against sandbox as well or
> >directly
> > > against its respective path ?
> > >
> > > Best regards,
> > > Fabian
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk based on emailv

Bruno Aranda
In reply to this post by fabf
Well, I normally do this trick:

- After doing what you have done, remove the project from the explorer
list (answer no when asked if the code must also be deleted).
- Create a new project with the same name ('current'?). It will tell
you that it already exists. Just do 'Next >'.
- If you have already done 'ant download-dependencies', put all the
jars in the current/lib folder in the eclipse's classpath.
- And that's all! (I guess)

If you have any doubt, don't hesitate to ask...

Bruno

2005/8/2, Fab Psycho <[hidden email]>:

> Sean,
>
>     I'm working with eclipse and do the following :
>
>      -go to svn repository
>      -check out current as a project
>      -go to java view.
>
> My problem is project 'current' is declared as generic project and I don't
> know how to change this  .... Wouldn't be interesting to place .project file
> to support directly eclipse (or whatever plateform you preconize to work on
> with myfaces).Or maybe there's a way to tell eclipse 'default builder is
> build/build.xml and this svn import is java stuff' or something ?
>
> PS:sorry for such trivial problem but I'm a java beginner :(
>
> Best regards,
> Fabian
>
> >From: Sean Schofield <[hidden email]>
> >Reply-To: Sean Schofield <[hidden email]>
> >To: MyFaces Development <[hidden email]>
> >Subject: Re: [jira] Commented: (MYFACES-372) url validator tag / tomahawk
> >based on emailv
> >Date: Tue, 2 Aug 2005 08:04:11 -0400
> >
> >Fabian,
> >
> >Examples for sandbox components should go in the examples subproject.
> >Within that subproject is a directory for 'sandbox' so generate your
> >new example there.  Documentation goes in the forrest subproject.
> >There is also a special sandbox directory there as well.
> >
> >Please do a test build of the site and examples to make sure that
> >everything compiles and looks good before supplying a patch.
> >
> >Thanks for contributing to MyFaces.
> >
> >sean
> >
> >On 8/2/05, Fab Psycho <[hidden email]> wrote:
> > > Hi Bruno,
> > >
> > >      Thanks for your comments ! Does relevant forrest documentation
> >patch
> > > and example addition have to be applied against sandbox as well or
> >directly
> > > against its respective path ?
> > >
> > > Best regards,
> > > Fabian
>
>
>