You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eyal Golan <eg...@gmail.com> on 2009/05/05 18:51:51 UTC

DateTextField design issue

Hello,
We use Wicket 1.3.5 and I found something annoying with the DateTextField.
In the constructor of that class, the converter is created internally.
If I want to use my own converter, I need to inherit DateTextField, add a
converter as a member, and return it in the getConverter method.

Why not have a protected method (that can be overridden) that returns the
converter:
Instead of:
    public DateTextField(String id, IModel model, String datePattern)
    {
        super(id, model, Date.class);
        this.datePattern = datePattern;
        *this.converter = new DateConverter()
        {
            private static final long serialVersionUID = 1L;

            /**
             * @see
org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
             */
            public DateFormat getDateFormat(Locale locale)
            {
                return new SimpleDateFormat(DateTextField.this.datePattern);
            }
        };*
    }

Do something like:
    public DateTextField(String id, IModel model, String datePattern)
    {
        super(id, model, Date.class);
        this.datePattern = datePattern;
        *this.converter = newDateConverter();*
    }
and

protected newDateConverter() {
     return new DateConverter()
        {
            private static final long serialVersionUID = 1L;

            /**
             * @see
org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
             */
            public DateFormat getDateFormat(Locale locale)
            {
                return new SimpleDateFormat(DateTextField.this.datePattern);
            }
        };
}

BTW, I know that we can also use the newConverterLocator() in our
application.

Do you think I should open a JIRA issue with 'wish' for that?


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary

Re: DateTextField design issue

Posted by Eyal Golan <eg...@gmail.com>.
More on that,
we used the newConverterLocator() in out application exactly as it is
suggested in WIA, page 297.
However, because the DateTextField has its own converter, we even don't get
to our customized converter.

Is it a bug?

Please advise.


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Tue, May 5, 2009 at 7:51 PM, Eyal Golan <eg...@gmail.com> wrote:

> Hello,
> We use Wicket 1.3.5 and I found something annoying with the DateTextField.
> In the constructor of that class, the converter is created internally.
> If I want to use my own converter, I need to inherit DateTextField, add a
> converter as a member, and return it in the getConverter method.
>
> Why not have a protected method (that can be overridden) that returns the
> converter:
> Instead of:
>     public DateTextField(String id, IModel model, String datePattern)
>     {
>         super(id, model, Date.class);
>         this.datePattern = datePattern;
>         *this.converter = new DateConverter()
>         {
>             private static final long serialVersionUID = 1L;
>
>             /**
>              * @see
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>              */
>             public DateFormat getDateFormat(Locale locale)
>             {
>                 return new
> SimpleDateFormat(DateTextField.this.datePattern);
>             }
>         };*
>     }
>
> Do something like:
>     public DateTextField(String id, IModel model, String datePattern)
>     {
>         super(id, model, Date.class);
>         this.datePattern = datePattern;
>         *this.converter = newDateConverter();*
>     }
> and
>
> protected newDateConverter() {
>      return new DateConverter()
>         {
>             private static final long serialVersionUID = 1L;
>
>             /**
>              * @see
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>              */
>             public DateFormat getDateFormat(Locale locale)
>             {
>                 return new
> SimpleDateFormat(DateTextField.this.datePattern);
>             }
>         };
> }
>
> BTW, I know that we can also use the newConverterLocator() in our
> application.
>
> Do you think I should open a JIRA issue with 'wish' for that?
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>

Re: DateTextField design issue

Posted by Eyal Golan <eg...@gmail.com>.
we looked the one from wicket-extensions


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> what is the full name of this class? there are two DateTextField
> classes in wicket codebase.
>
> -igor
>
> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
> > Hello,
> > We use Wicket 1.3.5 and I found something annoying with the
> DateTextField.
> > In the constructor of that class, the converter is created internally.
> > If I want to use my own converter, I need to inherit DateTextField, add a
> > converter as a member, and return it in the getConverter method.
> >
> > Why not have a protected method (that can be overridden) that returns the
> > converter:
> > Instead of:
> >    public DateTextField(String id, IModel model, String datePattern)
> >    {
> >        super(id, model, Date.class);
> >        this.datePattern = datePattern;
> >        *this.converter = new DateConverter()
> >        {
> >            private static final long serialVersionUID = 1L;
> >
> >            /**
> >             * @see
> >
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >             */
> >            public DateFormat getDateFormat(Locale locale)
> >            {
> >                return new
> SimpleDateFormat(DateTextField.this.datePattern);
> >            }
> >        };*
> >    }
> >
> > Do something like:
> >    public DateTextField(String id, IModel model, String datePattern)
> >    {
> >        super(id, model, Date.class);
> >        this.datePattern = datePattern;
> >        *this.converter = newDateConverter();*
> >    }
> > and
> >
> > protected newDateConverter() {
> >     return new DateConverter()
> >        {
> >            private static final long serialVersionUID = 1L;
> >
> >            /**
> >             * @see
> >
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >             */
> >            public DateFormat getDateFormat(Locale locale)
> >            {
> >                return new
> SimpleDateFormat(DateTextField.this.datePattern);
> >            }
> >        };
> > }
> >
> > BTW, I know that we can also use the newConverterLocator() in our
> > application.
> >
> > Do you think I should open a JIRA issue with 'wish' for that?
> >
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Ajax Request Security

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I received the following question in my personal email regarding this
thread.  I decided to respond here.

First, let me add this:
Remember that there is NO additional security given to you by POST as
it relates to GET.  Both are insecure if you pass the action (ie
delete), the key (ie entity ID) in the request and you perform the
request without authentication.


> Hey Jeremy, I saw your post on users-wicket.apache.org
> regarding Ajax security. One of your comments was regarding
> ajax state-changing calls and how they should be POSTs
> (which I absolutely agree with). I've noticed though that some
> of the Wicket Ajax classes use GETs for such operations.
> Do you think it's worth raising a bug or change request
> regarding this? Regards, Brendan

No - I don't think this is a bug.  I think that it was actually a
misunderstanding of what I said.  The point of my response was that
you need to validate the request no matter what kind it is - link
clicked - form submit - bookmarkable page requested - ajax request.
For security, you should not expose edit / delete actions via
bookmarkable pages (like you unfortunately must do in most PHP sites,
etc, where you pass the ID to a delete page...)  Instead, with Wicket,
the model is held in the session and referred to by the link - which
has NO data that could be fiddled with to modify the results.

Now, what I was saying when I said "typically your normal Ajax
behavior should not be deleting / editing unless it is a form post" is
that typically you are not going to have an AjaxUpdatingBehavior or an
ajax link that edits / deletes data (disclaimer: yes, there are
reasons to have an ajax delete link).  What I meant was not HTTP POST
- I just meant form submission - which in ajax actually happens via
GET.

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, May 8, 2009 at 12:14 AM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> If you have someone's session ID (within the lifetime of the session)
> you can break into any application - java, php, etc.  That's just how
> it is.  But if you have that level of information on them while the
> session is still live, then you are either already pulling off a man
> in the middle attack, sniffing their packets, or have compromised
> their machine or the server.
>
> It's not obfuscation - the links are relative to the path that you
> took through the application.  When your session expires, they can't
> be used any more.  But if you sent the link to someone else, in their
> session, the link wouldn't even work unless they took a path so
> similar to yours that their page map was the same (i.e. the fifth page
> in the page map was the edit users page, and they could click the
> sixth "editFoo" link on that page).
>
> Just look at the URLs that are generated when you add(new Link("foo")
> { public void onClick() {}};  - Now copy those to another computer and
> try them - no bueno.  Now, dump your cookies and get a new session -
> try the link - no bueno.
>
> And then, you should have action-level security anyway - so it should
> protect from unauthorized users completing actions that they should
> not be.  And typically your normal Ajax behavior should not be
> deleting / editing unless it is a form post (which you need to verify
> ajax or not) or a link (which again, needs to be subject to your
> role-based security).
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Thu, May 7, 2009 at 6:29 PM, Douglas Ferguson
> <do...@douglasferguson.us> wrote:
>> How is this session relative security implemented?
>>
>> Is this really just security through obfuscation?
>>
>> I.E. If you know the session id could you make valid Ajax Requests?
>>
>> Douglas
>>
>> -----Original Message-----
>> From: Jeremy Thomerson [mailto:jeremy@wickettraining.com]
>> Sent: Thursday, May 07, 2009 5:26 PM
>> To: users@wicket.apache.org
>> Subject: Re: Ajax Request Security
>>
>> Ajax requests, like non-bookmarkable links within Wicket, are
>> inherently secure through the fact that they are session-relative.
>> That is, unless you specifically try to make it less secure, it is
>> secure by default in that I can not just twiddle with an ID field in
>> the request URL to edit an entity with a different ID.
>>
>> However, many ajax requests may submit form data.  And, of course, all
>> such data DOES need to be checked - which should be accomplished
>> automatically if you have added validation to your form fields.
>> Again, the URL is session-relative, and can't be emailed to someone
>> else for them to use or fiddled with to create an unexpected request.
>> But the data itself that is submitted must always be verified.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Thu, May 7, 2009 at 5:22 PM, Douglas Ferguson
>> <do...@douglasferguson.us> wrote:
>>> It just dawned on me that most users will protect their url parameters to make sure that end users can't fiddle with parameters and see inappropriate data, however, is it conceivable to issue ajax requests to get an app to do something it shouldn't?
>>>
>>> If so, any tips on how to build a request that would cause an ajax response? Is important to protect all ajax calls?
>>>
>>> Dougals
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax Request Security

Posted by Jeremy Thomerson <je...@wickettraining.com>.
If you have someone's session ID (within the lifetime of the session)
you can break into any application - java, php, etc.  That's just how
it is.  But if you have that level of information on them while the
session is still live, then you are either already pulling off a man
in the middle attack, sniffing their packets, or have compromised
their machine or the server.

It's not obfuscation - the links are relative to the path that you
took through the application.  When your session expires, they can't
be used any more.  But if you sent the link to someone else, in their
session, the link wouldn't even work unless they took a path so
similar to yours that their page map was the same (i.e. the fifth page
in the page map was the edit users page, and they could click the
sixth "editFoo" link on that page).

Just look at the URLs that are generated when you add(new Link("foo")
{ public void onClick() {}};  - Now copy those to another computer and
try them - no bueno.  Now, dump your cookies and get a new session -
try the link - no bueno.

And then, you should have action-level security anyway - so it should
protect from unauthorized users completing actions that they should
not be.  And typically your normal Ajax behavior should not be
deleting / editing unless it is a form post (which you need to verify
ajax or not) or a link (which again, needs to be subject to your
role-based security).

--
Jeremy Thomerson
http://www.wickettraining.com




On Thu, May 7, 2009 at 6:29 PM, Douglas Ferguson
<do...@douglasferguson.us> wrote:
> How is this session relative security implemented?
>
> Is this really just security through obfuscation?
>
> I.E. If you know the session id could you make valid Ajax Requests?
>
> Douglas
>
> -----Original Message-----
> From: Jeremy Thomerson [mailto:jeremy@wickettraining.com]
> Sent: Thursday, May 07, 2009 5:26 PM
> To: users@wicket.apache.org
> Subject: Re: Ajax Request Security
>
> Ajax requests, like non-bookmarkable links within Wicket, are
> inherently secure through the fact that they are session-relative.
> That is, unless you specifically try to make it less secure, it is
> secure by default in that I can not just twiddle with an ID field in
> the request URL to edit an entity with a different ID.
>
> However, many ajax requests may submit form data.  And, of course, all
> such data DOES need to be checked - which should be accomplished
> automatically if you have added validation to your form fields.
> Again, the URL is session-relative, and can't be emailed to someone
> else for them to use or fiddled with to create an unexpected request.
> But the data itself that is submitted must always be verified.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Thu, May 7, 2009 at 5:22 PM, Douglas Ferguson
> <do...@douglasferguson.us> wrote:
>> It just dawned on me that most users will protect their url parameters to make sure that end users can't fiddle with parameters and see inappropriate data, however, is it conceivable to issue ajax requests to get an app to do something it shouldn't?
>>
>> If so, any tips on how to build a request that would cause an ajax response? Is important to protect all ajax calls?
>>
>> Dougals
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Ajax Request Security

Posted by Douglas Ferguson <do...@douglasferguson.us>.
How is this session relative security implemented?

Is this really just security through obfuscation?

I.E. If you know the session id could you make valid Ajax Requests?

Douglas

-----Original Message-----
From: Jeremy Thomerson [mailto:jeremy@wickettraining.com] 
Sent: Thursday, May 07, 2009 5:26 PM
To: users@wicket.apache.org
Subject: Re: Ajax Request Security

Ajax requests, like non-bookmarkable links within Wicket, are
inherently secure through the fact that they are session-relative.
That is, unless you specifically try to make it less secure, it is
secure by default in that I can not just twiddle with an ID field in
the request URL to edit an entity with a different ID.

However, many ajax requests may submit form data.  And, of course, all
such data DOES need to be checked - which should be accomplished
automatically if you have added validation to your form fields.
Again, the URL is session-relative, and can't be emailed to someone
else for them to use or fiddled with to create an unexpected request.
But the data itself that is submitted must always be verified.

--
Jeremy Thomerson
http://www.wickettraining.com




On Thu, May 7, 2009 at 5:22 PM, Douglas Ferguson
<do...@douglasferguson.us> wrote:
> It just dawned on me that most users will protect their url parameters to make sure that end users can't fiddle with parameters and see inappropriate data, however, is it conceivable to issue ajax requests to get an app to do something it shouldn't?
>
> If so, any tips on how to build a request that would cause an ajax response? Is important to protect all ajax calls?
>
> Dougals
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax Request Security

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Ajax requests, like non-bookmarkable links within Wicket, are
inherently secure through the fact that they are session-relative.
That is, unless you specifically try to make it less secure, it is
secure by default in that I can not just twiddle with an ID field in
the request URL to edit an entity with a different ID.

However, many ajax requests may submit form data.  And, of course, all
such data DOES need to be checked - which should be accomplished
automatically if you have added validation to your form fields.
Again, the URL is session-relative, and can't be emailed to someone
else for them to use or fiddled with to create an unexpected request.
But the data itself that is submitted must always be verified.

--
Jeremy Thomerson
http://www.wickettraining.com




On Thu, May 7, 2009 at 5:22 PM, Douglas Ferguson
<do...@douglasferguson.us> wrote:
> It just dawned on me that most users will protect their url parameters to make sure that end users can't fiddle with parameters and see inappropriate data, however, is it conceivable to issue ajax requests to get an app to do something it shouldn't?
>
> If so, any tips on how to build a request that would cause an ajax response? Is important to protect all ajax calls?
>
> Dougals
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Ajax Request Security

Posted by Douglas Ferguson <do...@douglasferguson.us>.
It just dawned on me that most users will protect their url parameters to make sure that end users can't fiddle with parameters and see inappropriate data, however, is it conceivable to issue ajax requests to get an app to do something it shouldn't?

If so, any tips on how to build a request that would cause an ajax response? Is important to protect all ajax calls? 

Dougals

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DateTextField design issue

Posted by Eyal Golan <eg...@gmail.com>.
What we actually want to do is, to use the regular converter for Date.class
with a small addition.
The converter uses a DateFormat. We want to set this DateFormat:
setLenient(true).
I thought to put it in the application scope as we want this everywhere in
the application.
Following this thread, I start thinking that your previous suggestion is the
best solution for us: just override the getConverter.


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, May 7, 2009 at 9:36 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> problem is datetextfield suppports different formats which require
> different converters, so it is a bit of a special case with regard to
> using a global date converter.
>
> -igor
>
> On Thu, May 7, 2009 at 11:16 AM, Eyal Golan <eg...@gmail.com> wrote:
> > "if you want to use your own converter then override getconverter() and
> > return whatever you like."
> >
> > True. This is what I suggested my mate when we discussed it. And I guess
> > this what we'll do.
> > But isn't using a converter for the whole application eliminates the need
> to
> > create a custom component?
> >
> > Thanks
> >
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
> >
> > On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >wrote:
> >
> >> if you want to use your own converter then override getconverter() and
> >> return whatever you like.
> >>
> >> -igor
> >>
> >> On Thu, May 7, 2009 at 1:38 AM, Eyal Golan <eg...@gmail.com> wrote:
> >> > I'm going to review on Sunday the code my team mate has made .
> >> > I'll be able to give you more information and see if maybe we
> >> misunderstood
> >> > something.
> >> >
> >> >
> >> > Eyal Golan
> >> > egolan74@gmail.com
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P  Save a tree. Please don't print this e-mail unless it's really
> >> necessary
> >> >
> >> >
> >> > On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <
> igor.vaynberg@gmail.com
> >> >wrote:
> >> >
> >> >> what is the full name of this class? there are two DateTextField
> >> >> classes in wicket codebase.
> >> >>
> >> >> -igor
> >> >>
> >> >> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com>
> wrote:
> >> >> > Hello,
> >> >> > We use Wicket 1.3.5 and I found something annoying with the
> >> >> DateTextField.
> >> >> > In the constructor of that class, the converter is created
> internally.
> >> >> > If I want to use my own converter, I need to inherit DateTextField,
> >> add a
> >> >> > converter as a member, and return it in the getConverter method.
> >> >> >
> >> >> > Why not have a protected method (that can be overridden) that
> returns
> >> the
> >> >> > converter:
> >> >> > Instead of:
> >> >> >    public DateTextField(String id, IModel model, String
> datePattern)
> >> >> >    {
> >> >> >        super(id, model, Date.class);
> >> >> >        this.datePattern = datePattern;
> >> >> >        *this.converter = new DateConverter()
> >> >> >        {
> >> >> >            private static final long serialVersionUID = 1L;
> >> >> >
> >> >> >            /**
> >> >> >             * @see
> >> >> >
> >> >>
> >>
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >> >> >             */
> >> >> >            public DateFormat getDateFormat(Locale locale)
> >> >> >            {
> >> >> >                return new
> >> >> SimpleDateFormat(DateTextField.this.datePattern);
> >> >> >            }
> >> >> >        };*
> >> >> >    }
> >> >> >
> >> >> > Do something like:
> >> >> >    public DateTextField(String id, IModel model, String
> datePattern)
> >> >> >    {
> >> >> >        super(id, model, Date.class);
> >> >> >        this.datePattern = datePattern;
> >> >> >        *this.converter = newDateConverter();*
> >> >> >    }
> >> >> > and
> >> >> >
> >> >> > protected newDateConverter() {
> >> >> >     return new DateConverter()
> >> >> >        {
> >> >> >            private static final long serialVersionUID = 1L;
> >> >> >
> >> >> >            /**
> >> >> >             * @see
> >> >> >
> >> >>
> >>
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >> >> >             */
> >> >> >            public DateFormat getDateFormat(Locale locale)
> >> >> >            {
> >> >> >                return new
> >> >> SimpleDateFormat(DateTextField.this.datePattern);
> >> >> >            }
> >> >> >        };
> >> >> > }
> >> >> >
> >> >> > BTW, I know that we can also use the newConverterLocator() in our
> >> >> > application.
> >> >> >
> >> >> > Do you think I should open a JIRA issue with 'wish' for that?
> >> >> >
> >> >> >
> >> >> > Eyal Golan
> >> >> > egolan74@gmail.com
> >> >> >
> >> >> > Visit: http://jvdrums.sourceforge.net/
> >> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >> >
> >> >> > P  Save a tree. Please don't print this e-mail unless it's really
> >> >> necessary
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: DateTextField design issue

Posted by Igor Vaynberg <ig...@gmail.com>.
problem is datetextfield suppports different formats which require
different converters, so it is a bit of a special case with regard to
using a global date converter.

-igor

On Thu, May 7, 2009 at 11:16 AM, Eyal Golan <eg...@gmail.com> wrote:
> "if you want to use your own converter then override getconverter() and
> return whatever you like."
>
> True. This is what I suggested my mate when we discussed it. And I guess
> this what we'll do.
> But isn't using a converter for the whole application eliminates the need to
> create a custom component?
>
> Thanks
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>
>
> On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> if you want to use your own converter then override getconverter() and
>> return whatever you like.
>>
>> -igor
>>
>> On Thu, May 7, 2009 at 1:38 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > I'm going to review on Sunday the code my team mate has made .
>> > I'll be able to give you more information and see if maybe we
>> misunderstood
>> > something.
>> >
>> >
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P  Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>> >
>> > On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <igor.vaynberg@gmail.com
>> >wrote:
>> >
>> >> what is the full name of this class? there are two DateTextField
>> >> classes in wicket codebase.
>> >>
>> >> -igor
>> >>
>> >> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
>> >> > Hello,
>> >> > We use Wicket 1.3.5 and I found something annoying with the
>> >> DateTextField.
>> >> > In the constructor of that class, the converter is created internally.
>> >> > If I want to use my own converter, I need to inherit DateTextField,
>> add a
>> >> > converter as a member, and return it in the getConverter method.
>> >> >
>> >> > Why not have a protected method (that can be overridden) that returns
>> the
>> >> > converter:
>> >> > Instead of:
>> >> >    public DateTextField(String id, IModel model, String datePattern)
>> >> >    {
>> >> >        super(id, model, Date.class);
>> >> >        this.datePattern = datePattern;
>> >> >        *this.converter = new DateConverter()
>> >> >        {
>> >> >            private static final long serialVersionUID = 1L;
>> >> >
>> >> >            /**
>> >> >             * @see
>> >> >
>> >>
>> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>> >> >             */
>> >> >            public DateFormat getDateFormat(Locale locale)
>> >> >            {
>> >> >                return new
>> >> SimpleDateFormat(DateTextField.this.datePattern);
>> >> >            }
>> >> >        };*
>> >> >    }
>> >> >
>> >> > Do something like:
>> >> >    public DateTextField(String id, IModel model, String datePattern)
>> >> >    {
>> >> >        super(id, model, Date.class);
>> >> >        this.datePattern = datePattern;
>> >> >        *this.converter = newDateConverter();*
>> >> >    }
>> >> > and
>> >> >
>> >> > protected newDateConverter() {
>> >> >     return new DateConverter()
>> >> >        {
>> >> >            private static final long serialVersionUID = 1L;
>> >> >
>> >> >            /**
>> >> >             * @see
>> >> >
>> >>
>> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>> >> >             */
>> >> >            public DateFormat getDateFormat(Locale locale)
>> >> >            {
>> >> >                return new
>> >> SimpleDateFormat(DateTextField.this.datePattern);
>> >> >            }
>> >> >        };
>> >> > }
>> >> >
>> >> > BTW, I know that we can also use the newConverterLocator() in our
>> >> > application.
>> >> >
>> >> > Do you think I should open a JIRA issue with 'wish' for that?
>> >> >
>> >> >
>> >> > Eyal Golan
>> >> > egolan74@gmail.com
>> >> >
>> >> > Visit: http://jvdrums.sourceforge.net/
>> >> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >> >
>> >> > P  Save a tree. Please don't print this e-mail unless it's really
>> >> necessary
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DateTextField design issue

Posted by Eyal Golan <eg...@gmail.com>.
"if you want to use your own converter then override getconverter() and
return whatever you like."

True. This is what I suggested my mate when we discussed it. And I guess
this what we'll do.
But isn't using a converter for the whole application eliminates the need to
create a custom component?

Thanks


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> if you want to use your own converter then override getconverter() and
> return whatever you like.
>
> -igor
>
> On Thu, May 7, 2009 at 1:38 AM, Eyal Golan <eg...@gmail.com> wrote:
> > I'm going to review on Sunday the code my team mate has made .
> > I'll be able to give you more information and see if maybe we
> misunderstood
> > something.
> >
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
> >
> > On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >wrote:
> >
> >> what is the full name of this class? there are two DateTextField
> >> classes in wicket codebase.
> >>
> >> -igor
> >>
> >> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
> >> > Hello,
> >> > We use Wicket 1.3.5 and I found something annoying with the
> >> DateTextField.
> >> > In the constructor of that class, the converter is created internally.
> >> > If I want to use my own converter, I need to inherit DateTextField,
> add a
> >> > converter as a member, and return it in the getConverter method.
> >> >
> >> > Why not have a protected method (that can be overridden) that returns
> the
> >> > converter:
> >> > Instead of:
> >> >    public DateTextField(String id, IModel model, String datePattern)
> >> >    {
> >> >        super(id, model, Date.class);
> >> >        this.datePattern = datePattern;
> >> >        *this.converter = new DateConverter()
> >> >        {
> >> >            private static final long serialVersionUID = 1L;
> >> >
> >> >            /**
> >> >             * @see
> >> >
> >>
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >> >             */
> >> >            public DateFormat getDateFormat(Locale locale)
> >> >            {
> >> >                return new
> >> SimpleDateFormat(DateTextField.this.datePattern);
> >> >            }
> >> >        };*
> >> >    }
> >> >
> >> > Do something like:
> >> >    public DateTextField(String id, IModel model, String datePattern)
> >> >    {
> >> >        super(id, model, Date.class);
> >> >        this.datePattern = datePattern;
> >> >        *this.converter = newDateConverter();*
> >> >    }
> >> > and
> >> >
> >> > protected newDateConverter() {
> >> >     return new DateConverter()
> >> >        {
> >> >            private static final long serialVersionUID = 1L;
> >> >
> >> >            /**
> >> >             * @see
> >> >
> >>
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >> >             */
> >> >            public DateFormat getDateFormat(Locale locale)
> >> >            {
> >> >                return new
> >> SimpleDateFormat(DateTextField.this.datePattern);
> >> >            }
> >> >        };
> >> > }
> >> >
> >> > BTW, I know that we can also use the newConverterLocator() in our
> >> > application.
> >> >
> >> > Do you think I should open a JIRA issue with 'wish' for that?
> >> >
> >> >
> >> > Eyal Golan
> >> > egolan74@gmail.com
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P  Save a tree. Please don't print this e-mail unless it's really
> >> necessary
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: DateTextField design issue

Posted by Igor Vaynberg <ig...@gmail.com>.
if you want to use your own converter then override getconverter() and
return whatever you like.

-igor

On Thu, May 7, 2009 at 1:38 AM, Eyal Golan <eg...@gmail.com> wrote:
> I'm going to review on Sunday the code my team mate has made .
> I'll be able to give you more information and see if maybe we misunderstood
> something.
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>
>
> On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> what is the full name of this class? there are two DateTextField
>> classes in wicket codebase.
>>
>> -igor
>>
>> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > Hello,
>> > We use Wicket 1.3.5 and I found something annoying with the
>> DateTextField.
>> > In the constructor of that class, the converter is created internally.
>> > If I want to use my own converter, I need to inherit DateTextField, add a
>> > converter as a member, and return it in the getConverter method.
>> >
>> > Why not have a protected method (that can be overridden) that returns the
>> > converter:
>> > Instead of:
>> >    public DateTextField(String id, IModel model, String datePattern)
>> >    {
>> >        super(id, model, Date.class);
>> >        this.datePattern = datePattern;
>> >        *this.converter = new DateConverter()
>> >        {
>> >            private static final long serialVersionUID = 1L;
>> >
>> >            /**
>> >             * @see
>> >
>> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>> >             */
>> >            public DateFormat getDateFormat(Locale locale)
>> >            {
>> >                return new
>> SimpleDateFormat(DateTextField.this.datePattern);
>> >            }
>> >        };*
>> >    }
>> >
>> > Do something like:
>> >    public DateTextField(String id, IModel model, String datePattern)
>> >    {
>> >        super(id, model, Date.class);
>> >        this.datePattern = datePattern;
>> >        *this.converter = newDateConverter();*
>> >    }
>> > and
>> >
>> > protected newDateConverter() {
>> >     return new DateConverter()
>> >        {
>> >            private static final long serialVersionUID = 1L;
>> >
>> >            /**
>> >             * @see
>> >
>> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>> >             */
>> >            public DateFormat getDateFormat(Locale locale)
>> >            {
>> >                return new
>> SimpleDateFormat(DateTextField.this.datePattern);
>> >            }
>> >        };
>> > }
>> >
>> > BTW, I know that we can also use the newConverterLocator() in our
>> > application.
>> >
>> > Do you think I should open a JIRA issue with 'wish' for that?
>> >
>> >
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P  Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DateTextField design issue

Posted by Eyal Golan <eg...@gmail.com>.
I'm going to review on Sunday the code my team mate has made .
I'll be able to give you more information and see if maybe we misunderstood
something.


Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> what is the full name of this class? there are two DateTextField
> classes in wicket codebase.
>
> -igor
>
> On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
> > Hello,
> > We use Wicket 1.3.5 and I found something annoying with the
> DateTextField.
> > In the constructor of that class, the converter is created internally.
> > If I want to use my own converter, I need to inherit DateTextField, add a
> > converter as a member, and return it in the getConverter method.
> >
> > Why not have a protected method (that can be overridden) that returns the
> > converter:
> > Instead of:
> >    public DateTextField(String id, IModel model, String datePattern)
> >    {
> >        super(id, model, Date.class);
> >        this.datePattern = datePattern;
> >        *this.converter = new DateConverter()
> >        {
> >            private static final long serialVersionUID = 1L;
> >
> >            /**
> >             * @see
> >
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >             */
> >            public DateFormat getDateFormat(Locale locale)
> >            {
> >                return new
> SimpleDateFormat(DateTextField.this.datePattern);
> >            }
> >        };*
> >    }
> >
> > Do something like:
> >    public DateTextField(String id, IModel model, String datePattern)
> >    {
> >        super(id, model, Date.class);
> >        this.datePattern = datePattern;
> >        *this.converter = newDateConverter();*
> >    }
> > and
> >
> > protected newDateConverter() {
> >     return new DateConverter()
> >        {
> >            private static final long serialVersionUID = 1L;
> >
> >            /**
> >             * @see
> >
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
> >             */
> >            public DateFormat getDateFormat(Locale locale)
> >            {
> >                return new
> SimpleDateFormat(DateTextField.this.datePattern);
> >            }
> >        };
> > }
> >
> > BTW, I know that we can also use the newConverterLocator() in our
> > application.
> >
> > Do you think I should open a JIRA issue with 'wish' for that?
> >
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: DateTextField design issue

Posted by Igor Vaynberg <ig...@gmail.com>.
what is the full name of this class? there are two DateTextField
classes in wicket codebase.

-igor

On Tue, May 5, 2009 at 9:51 AM, Eyal Golan <eg...@gmail.com> wrote:
> Hello,
> We use Wicket 1.3.5 and I found something annoying with the DateTextField.
> In the constructor of that class, the converter is created internally.
> If I want to use my own converter, I need to inherit DateTextField, add a
> converter as a member, and return it in the getConverter method.
>
> Why not have a protected method (that can be overridden) that returns the
> converter:
> Instead of:
>    public DateTextField(String id, IModel model, String datePattern)
>    {
>        super(id, model, Date.class);
>        this.datePattern = datePattern;
>        *this.converter = new DateConverter()
>        {
>            private static final long serialVersionUID = 1L;
>
>            /**
>             * @see
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>             */
>            public DateFormat getDateFormat(Locale locale)
>            {
>                return new SimpleDateFormat(DateTextField.this.datePattern);
>            }
>        };*
>    }
>
> Do something like:
>    public DateTextField(String id, IModel model, String datePattern)
>    {
>        super(id, model, Date.class);
>        this.datePattern = datePattern;
>        *this.converter = newDateConverter();*
>    }
> and
>
> protected newDateConverter() {
>     return new DateConverter()
>        {
>            private static final long serialVersionUID = 1L;
>
>            /**
>             * @see
> org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>             */
>            public DateFormat getDateFormat(Locale locale)
>            {
>                return new SimpleDateFormat(DateTextField.this.datePattern);
>            }
>        };
> }
>
> BTW, I know that we can also use the newConverterLocator() in our
> application.
>
> Do you think I should open a JIRA issue with 'wish' for that?
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org