You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Fabien D." <du...@hotmail.com> on 2008/06/06 16:39:35 UTC

Create WebPage inside a TimerTask Class

Hi,

I have a timer class associated with  a timertask class, to send daily an
email generated by wicket....

But in my timertask when I try to create my WebPage thanks to the
constructor, it never enters to the constructor...

I would like to do something like that :

in my timertask
...
EmailPage emailcontent = new EmailPage(user,list_sous_domaine,
abo.getDateAncienne() , abo.getDateFuture());
emailcontent.render();
String message_corps = emailcontent.getSource(); 
....



public class EmailPage extends WebPage{
	
	public EmailPage(TUtilisateur user, List list_sousdomaine, Date ancien,
Date futur){
		log.info("Testing !! "); -> never displayed
         .....
        }
....
}


How can I solve this problem?

Thank you in advance for your help
-- 
View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17693737.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Create WebPage inside a TimerTask Class

Posted by Igor Vaynberg <ig...@gmail.com>.
you should use wickettester to do this...that will create all the
proper threadlocal mocks you need.

-igor


On Mon, Jun 9, 2008 at 12:48 AM, Fabien D. <du...@hotmail.com> wrote:
>
> Hi, thank you for tour help...
>
> This is a very strange behavior. I have tried to display this page, so I
> have created a link to this page, and everything is good, I have my Page,
> and it enters into the constructor.
>
> I have tried to put this timer class into a WebPage put, unfortunately it
> does'nt enter into the constructor!!
>
> And finally, I have made a simpleThread like this :
>
> public class GestionThread extends java.lang.Thread{
>        private boolean stopThread = false;
>
>        public void run() {
>
>                boolean fin = false;
>                GestionEmail g = new GestionEmail();
>                g.emailTimer(new Date());
>
>        }
>
> It does'nt enter into the constructor to!!
> It stops at this line :
>
> .....
> log.info(Testing1"); -> display
> EmailPage emailcontent = new EmailPage(user,list_sous_domaine,
> abo.getDateAncienne() , abo.getDateFuture());
>
> .....
>
> .....
>        public EmailPage(TUtilisateur user, List list_sousdomaine, Date ancien,
> Date futur){
>                log.info(Testing2"); -> never display
>                this.user = user;
>                this.list_sousdomaine = list_sousdomaine;
>                this.ancien = ancien;
>                this.futur = futur;
>                this.initPage();
>        }
> .....
>
> If someone have an idea to solve this problem! Thank you in advance.
> --
> View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17728018.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Create WebPage inside a TimerTask Class

Posted by "Fabien D." <du...@hotmail.com>.
Hi, thank you for tour help...

This is a very strange behavior. I have tried to display this page, so I
have created a link to this page, and everything is good, I have my Page,
and it enters into the constructor.

I have tried to put this timer class into a WebPage put, unfortunately it
does'nt enter into the constructor!!

And finally, I have made a simpleThread like this :

public class GestionThread extends java.lang.Thread{
	private boolean stopThread = false;

	public void run() {
		
	        boolean fin = false;
	    	GestionEmail g = new GestionEmail();
	    	g.emailTimer(new Date());

	} 

It does'nt enter into the constructor to!!
It stops at this line :

.....
log.info(Testing1"); -> display
EmailPage emailcontent = new EmailPage(user,list_sous_domaine,
abo.getDateAncienne() , abo.getDateFuture());

.....

.....
	public EmailPage(TUtilisateur user, List list_sousdomaine, Date ancien,
Date futur){
		log.info(Testing2"); -> never display
		this.user = user;
		this.list_sousdomaine = list_sousdomaine;
		this.ancien = ancien;
		this.futur = futur;
		this.initPage();
	}
.....

If someone have an idea to solve this problem! Thank you in advance.
-- 
View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17728018.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Create WebPage inside a TimerTask Class

Posted by Eelco Hillenius <ee...@gmail.com>.
You'll need to set the whole thread up like you would regularly do
when you want to construct and render a Wicket page in a separate
thread. After that, it should just work. If it doesn't even execute
your log statement, I suspect something else is wrong. Do you have a
stack trace to share?

Eelco

On Fri, Jun 6, 2008 at 7:39 AM, Fabien D. <du...@hotmail.com> wrote:
>
> Hi,
>
> I have a timer class associated with  a timertask class, to send daily an
> email generated by wicket....
>
> But in my timertask when I try to create my WebPage thanks to the
> constructor, it never enters to the constructor...
>
> I would like to do something like that :
>
> in my timertask
> ...
> EmailPage emailcontent = new EmailPage(user,list_sous_domaine,
> abo.getDateAncienne() , abo.getDateFuture());
> emailcontent.render();
> String message_corps = emailcontent.getSource();
> ....
>
>
>
> public class EmailPage extends WebPage{
>
>        public EmailPage(TUtilisateur user, List list_sousdomaine, Date ancien,
> Date futur){
>                log.info("Testing !! "); -> never displayed
>         .....
>        }
> ....
> }
>
>
> How can I solve this problem?
>
> Thank you in advance for your help
> --
> View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17693737.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Create WebPage inside a normal

Posted by "Fabien D." <du...@hotmail.com>.
Okay, sorry :)
-- 
View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17694175.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Create WebPage inside a normal

Posted by James Carman <ja...@carmanconsulting.com>.
Maybe it just comes across like this on the email list.  You're using
Nabble to edit your "post", so maybe it just sent two different emails
when you edited the title?  Sorry, but the experience is a bit
different between us email-based users and the ones using Nabble as a
forum.


On Fri, Jun 6, 2008 at 10:50 AM, Fabien D. <du...@hotmail.com> wrote:
>
> Why Are you saying that i double post??
>
> --
> View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17694013.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Create WebPage inside a normal

Posted by "Fabien D." <du...@hotmail.com>.
Why Are you saying that i double post??

-- 
View this message in context: http://www.nabble.com/Create-WebPage-inside-a-TimerTask-Class-tp17693737p17694013.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Create WebPage inside a normal

Posted by James Carman <ja...@carmanconsulting.com>.
Please don't double-post.  We get a lot of traffic on this list and
having to read the same message twice doesn't help.

On Fri, Jun 6, 2008 at 10:39 AM, Fabien D. <du...@hotmail.com> wrote:
>
> Hi,
>
> I have a timer class associated with  a timertask class, to send daily an
> email generated by wicket....
>
> But in my timertask when I try to create my WebPage thanks to the
> constructor, it never enters to the constructor...
>
> I would like to do something like that :
>
> in my timertask
> ...
> EmailPage emailcontent = new EmailPage(user,list_sous_domaine,
> abo.getDateAncienne() , abo.getDateFuture());
> emailcontent.render();
> String message_corps = emailcontent.getSource();
> ....
>
>
>
> public class EmailPage extends WebPage{
>
>        public EmailPage(TUtilisateur user, List list_sousdomaine, Date ancien,
> Date futur){
>                log.info("Testing !! "); -> never displayed
>         .....
>        }
> ....
> }
>
>
> How can I solve this problem?
>
> Thank you in advance for your help
> --
> View this message in context: http://www.nabble.com/Create-WebPage-inside-a-normal-tp17693737p17693737.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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