Re: my Java EE tragic story.

2008-04-12 Thread Mohammad Shamsi
No, it doesn't about Tapestry.

its about my problems during migration from lightweight containers to the
Java EE standard world.



On Sat, Apr 12, 2008 at 11:27 AM, adasal <[EMAIL PROTECTED]> wrote:

> Your blog doesn't seem to be about Tapestry.
> I believe there are standards, but the standards have boarders which may
> be
> redefined as the standard evolves. What is inside the boarder will be
> interoperable, What is outside is left to the implementer.
> It is very possible to misunderstand the standard and find that two
> seeming
> incompatible implementations are both correct and are compatible. These
> things are complex.
> I don't understand your point 4. But I doubt that TopLink is short on
> features and capability. Maybe if you explain more fully, but this doesn't
> belong to the Tapestry list.
> What may belong here is how much Tapestry falls within the boarders of
> J2EE
> conformance, or does it touch on it at all? I would have thought it
> doesn't
> and any implementation made with Tapestry will be conforment where
> standards
> dictate.
> Adam
>
> On 12/04/2008, Mohammad Shamsi <[EMAIL PROTECTED]> wrote:
> >
> > Hi Friends,
> >
> > please take a look at my blog about Java EE and my problems with it.
> >
> > http://mhshams.blogspot.com/
> >
> >
> > --
> > sincerely yours
> > M. H. Shamsi
> >
>



-- 
sincerely yours
M. H. Shamsi


Re: Component reloading is not working

2008-04-12 Thread Andy Huhn
Hi Jakob,

Well, I tried what you mentioned, and it now picks up changes to my .tml
right away--definitely an improvement over before.  I think I am seeing
the same problem you are seeing, though, because it is not picking up
changes to my page classes.

If I modify a page class and save in Eclipse (3.2.2), I get this error:
"Java HotSpot(TM) 64-Bit Server VM[localhost:8080] (may be out of synch)
was unable to replace the running code with the code in the workspace.

Reason: Hot code replace failed - Scheme change not implemented"

I wish I could help you, but as you can see, I'm dealing with the same
issue you are.  :o)

Perhaps one of the other folks on the list might have some better ideas.

Andy

On Sat, 2008-04-12 at 19:26 +0200, Jakob Keres wrote:
> Am Samstag, den 12.04.2008, 11:28 -0400 schrieb Andy Huhn:
> > Hi Jakob,
> > 
> > Also, which version of Jetty are you using?
> 
> 
> Jetty6 but...
> 
> >   I don't believe there's a
> > way to get component reloading working yet with Eclipse + Jetty6,
> > although there is with Eclipse + Jetty5.
> 
> ...it's working. I just adpated the build path in Eclipse3.3 like this:
> 
> Project Properties -> Java Build Path 
> Tab Source: added folder src/main/resources
> Default output folder for all: projectname/target/classes
> 
> Tab Libraries: removed the class folder with the resources directory
> 
> Not sure, if this is the common way to do, but it works quite fine.
> 
> Greets
> Jakob
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] [FAQ] Form and old errors/data

2008-04-12 Thread Geoff Callender
It's great that we have these workarounds to prevent leaving  
ValidationTrackerImpl objects littered throughout the session, but I'm  
having trouble understanding how it came to this.  After all, I can't  
think of a single case where I'd want a form's validation errors to be  
retained after the form has been displayed.  So why not make "flash"  
persistence the default for Form's ValidationTracker so we can all  
forget about it?


Geoff

On 28/02/2008, at 11:43 PM, Robert Zeigler wrote:

You can also provide the tracker parameter to form, which looks  
almost the same as extending form, except that you don't have to  
extend form. :)


@Component(parameters={"tracker=customTracker"})
private Form form;

@Persist("flash")
private ValidationTracker customTracker;

public ValidationTracker getCustomTracker() {
if (customTracker == null) {
customTracker = new ValidationTrackerImpl();
   }
   return customTracker;
}

Robert

On Feb 28, 2008, at 2/283:39 AM , Christian Köberl wrote:



Q: Why does the form show old data and old errors not the newly set  
object?

(see:
http://www.nabble.com/-T5--Why-is-default-ValidationTracker-in-Form-marked-Persist-not-Persist%28%22flash%22%29-td11981083.html)

A1: Write your own form extending the tapestry default form:
public class Form extends org.apache.tapestry.corelib.components.Form
{
@Persist("flash")
private ValidationTracker defaultTracker;

@Override
 public ValidationTracker getDefaultTracker()
{
if (defaultTracker == null)
defaultTracker = new ValidationTrackerImpl();

return defaultTracker;
}

@Override
 public void setDefaultTracker(ValidationTracker defaultTracker)
{
this.defaultTracker = defaultTracker;
}

}

A2: use @Meta("tapestry.persistence-strategy=flash") on your page  
to control
the default persistence of components below it. This will result in  
*all*

components having a default flash persistence.

@Howard: any better idea?

--
Chris
--
View this message in context: 
http://www.nabble.com/Writing-an-FAQ-for-Tapestry-5-tp15719185p15732836.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



t5: logging pages

2008-04-12 Thread Angelo Chen

Hi,

I would like to keep a log of visits made by viewers, what page he goes,
from what IP he comes, etc. what is a good place to do this, a dispatcher?
or any good suggestions in adding a logging facility in T5? Thanks,

Angelo
-- 
View this message in context: 
http://www.nabble.com/t5%3A-logging-pages-tp16656674p16656674.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RequestGlobals in a PersistentFieldStrategy

2008-04-12 Thread nicholas Krul
Hi guys.

I have implemented a new PersistentFieldStrategy (cookie based), and am
having just one problem...

@Inject
private RequestGlobals requestGlobals

isn't processed... and I know of no other way to get it into the strategy to
make it work (it is from the base package).

I don't care how, just need access to RequestGlobals... for access to
servlet cookie control (T5 cookies doesn;t have a 'list' ability).

Thanks

--nK


T5: Return javascript in zone markup

2008-04-12 Thread Andrew Court

Hi all,

I don't know if this functionality has been built into the zone component
yet (using 5.0.11 release), but what I'm trying to do is return additional
javascript along with html markup in an ajax response. Is this possible, and
if so how would one go about doing it?

And while I'm here, I've noticed what seems to be an issue with the @Secure
forced redirect from http to https. Any querystring parameters appended to
the url are dropped. It seems to me that it would be useful if these could
be passed along too.

Thanks for any help,
Andrew
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Return-javascript-in-zone-markup-tp16656452p16656452.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: my Java EE tragic story.

2008-04-12 Thread adasal
Your blog doesn't seem to be about Tapestry.
I believe there are standards, but the standards have boarders which may be
redefined as the standard evolves. What is inside the boarder will be
interoperable, What is outside is left to the implementer.
It is very possible to misunderstand the standard and find that two seeming
incompatible implementations are both correct and are compatible. These
things are complex.
I don't understand your point 4. But I doubt that TopLink is short on
features and capability. Maybe if you explain more fully, but this doesn't
belong to the Tapestry list.
What may belong here is how much Tapestry falls within the boarders of J2EE
conformance, or does it touch on it at all? I would have thought it doesn't
and any implementation made with Tapestry will be conforment where standards
dictate.
Adam

On 12/04/2008, Mohammad Shamsi <[EMAIL PROTECTED]> wrote:
>
> Hi Friends,
>
> please take a look at my blog about Java EE and my problems with it.
>
> http://mhshams.blogspot.com/
>
>
> --
> sincerely yours
> M. H. Shamsi
>


Re: T5 : session timeout

2008-04-12 Thread Josh Canfield
>  I think that your solution is the best but also the hardest way ! Checking
> every properties in every pages ... wooahh !

:) Hehehe... yeah, I tend to lean towards correct over easy.


On Sat, Apr 12, 2008 at 2:24 AM, Stephane Decleire
<[EMAIL PROTECTED]> wrote:
> Thanks Josh,
>
>  I think that your solution is the best but also the hardest way ! Checking
> every properties in every pages ... wooahh !
>  Would not it be very handy to have the framework raise an event in case of
> a session loss (for example as for a 404 error) that we could catch to
> simply redirect to a specific page or to further investigate and check
> properties like in your solution for specific pages ?
>
>
>
>  Stephane
>
>  Josh Canfield a écrit :
>
> > Hey Stephane,
> >
> >
> >
> > > I think that i did not explain very well the problem i encounter ... so
> i
> > > will try to explain it better (so hard in a foreign language ...)
> > >
> > >
> >
> > I understood the problem, sorry if my answer didn't give you what you
> needed :)
> >
> >
> >
> > > In this case, it will just be an inconvenient but if the property is an
> > > object and not a string and this object is used in the rendering of the
> page
> > > B, we will get the awfull "Null pointer exception" error !!! :-(
> > >
> > >
> >
> > The basic pattern would be to check your state in one of your
> > onActivate methods and redirect or proceed based on your requirements.
> > activation events are called in order of name, then number of
> > properties so you can pick whether your activation happens before or
> > after your general activation occurs.
> >
> > @OnEvent("activate")
> > public Object _onActivate() {
> > // to run before other activation handlers
> > // check @Persist properties
> > }
> >
> > If this is a common property between a set of pages then you can
> > consider creating a base class with it's own activation handler to
> > consolidate your property validation. If the property is invalid
> > (null, incomplete, etc) you can do the right thing for your pages
> > whether that is redirecting to another page, initialize the object
> > somehow or something else. In some cases, like message, do nothing is
> > probably an ok answer.
> >
> >
> >
> > > In the simplest case, we need to check the existence of the HTTP session
> in
> > > allmost all page activation events and redirect the user on a specific
> page
> > > when the session as expired !
> > >
> > >
> >
> > I wouldn't check for the existence of the HTTP session, I'd actually
> > validate the individual properties in the page. This is what I mean by
> > programming defensively. You can't infer that if a session exists, or
> > even that one of your properties is set, that all of your properties
> > are safe, who knows how your user got to the page, or how your
> > co-worker wrote his page that is linking to yours.
> >
> > Josh
> >
> > On Fri, Apr 11, 2008 at 2:57 AM, Stephane Decleire
> > <[EMAIL PROTECTED]> wrote:
> >
> >
> > > I think that i did not explain very well the problem i encounter ... so
> i
> > > will try to explain it better (so hard in a foreign language ...)
> > >
> > > Suppose i have a page A which call a page B after initializing a
> property of
> > > B :
> > >
> > > [Page A]
> > >
> > > @InjectPage
> > > private B b;
> > >
> > > @OnEvent (value="action")
> > > Object gotoB() {
> > >  b.setMessage("hello");
> > >  return b;
> > > }
> > >
> > > The user is now on the page B with its welcome message. He takes a break
> at
> > > the coffee machine. When he comes back, he tries to refresh his page.
> But he
> > > has discuss two much time with his friends while drinking his coffee and
> his
> > > session has just expired ! (the session there is the HTTP session).
> > > For Tapestry, that's mean that a new HTTP session will be created for
> this
> > > user and the page B will be rendered one more time as if the user was a
> new
> > > one. As a consequence, the content of the message property will not be
> set
> > > when the page B is rendered.
> > > In this case, it will just be an inconvenient but if the property is an
> > > object and not a string and this object is used in the rendering of the
> page
> > > B, we will get the awfull "Null pointer exception" error !!! :-(
> > > Since, the power of Tapestry is to present the developer "HTML pages" as
> > > objects, passing data by setting properties from page to page is a
> common
> > > pattern and we need to check for the presence of our properties in
> allmost
> > > all pages of an application when the HTTP session is lost.
> > > In the simplest case, we need to check the existence of the HTTP session
> in
> > > allmost all page activation events and redirect the user on a specific
> page
> > > when the session as expired !
> > > Am i wrong ?
> > >
> > > Stephane
> > >
> > > Josh Canfield a écrit :
> > >
> > >
> > >
> > >
> > > >
> > > > > One approach is to store this data transiently in an ASO.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > ht

Re: [T5] enum/BeanEditForm issue

2008-04-12 Thread Andy Huhn
Well, fortunately and unfortunately, that was it.

Thanks again, Peter, for finding my mistake.  And sorry again for
cluttering up the list with my poor proofreading skills.

Andy

On Fri, 2008-04-11 at 12:41 -0400, Andy Huhn wrote:
> Oh, brother.  If that's it, take my keyboard away from me.  :o)
> 
> I'll check as soon as I get on tonight.  If that's it, sorry for troubling
> the list.
> 
> Andy
> 
> On Fri, 11 Apr 2008 11:20:43 -0400, "Peter Beshai" <[EMAIL PROTECTED]>
> wrote:
> > Unless there's a typo in your post:
> > 
> > public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >{ this.ageRangeSrvd = ageRangeSrvd; }
> > 
> > The parameter's name is 'ageRangeeSrvd'  not ageRangeSrvd, so you're not
> > setting it.
> > 
> > e.g. You're doing:
> > private String _name;
> > 
> > public void setName(String name)
> > {
> > this._name = _name;
> > }
> > 
> > Peter Beshai
> > 
> > On Fri, Apr 11, 2008 at 10:06 AM, Filip S. Adamsen <[EMAIL PROTECTED]>
> wrote:
> > 
> >> That's odd.
> >>
> >> What does your page class/template look like?
> >>
> >> -Filip
> >>
> >>
> >> On 2008-04-11 10:15, Andy Huhn wrote:
> >>
> >> > Hello,
> >> >
> >> > I have what I thought was a fairly straightforward piece of code, but
> > I
> >> > can't seem to get it working.
> >> >
> >> > I have an enum defined as:
> >> >
> >> >public enum AgeRange {
> >> >K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
> >> >}
> >> >
> >> > I reference this enum in one of my POJOs:
> >> >
> >> >public class CoOp extends Entity {
> >> >protected AgeRange ageRangeSrvd;
> >> >
> >> >public AgeRange getAgeRangeSrvd()
> >> >{ return ageRangeSrvd;}
> >> >
> >> >public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >> >{ this.ageRangeSrvd = ageRangeSrvd; }
> >> >}
> >> >
> >> > And then I have a BeanEditForm to edit the POJO.
> >> >
> >> > The BeanEditForm correctly displays a drop-down with the correct list
> > of
> >> > values, but if I edit the drop-down and submit the form, it doesn't
> > seem
> >> > to pick up the changed value.  It picks up null each time.
> >> >
> >> > Any ideas?
> >> >
> >> > If it's at all relevant, I used Gavin King's GenericEnumUserType to
> > get
> >> > Hibernate to persist the enum (http://www.hibernate.org/272.html). 
> > But
> >> > I can't see how my Hibernate configuration would affect Tapestry's
> >> > ability to encode/decode the enum value.
> >> >
> >> > Thanks,
> >> > Andy
> >> >
> >> >
> >> > -
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> >
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Component reloading is not working

2008-04-12 Thread Jakob Keres

Am Samstag, den 12.04.2008, 11:28 -0400 schrieb Andy Huhn:
> Hi Jakob,
> 
> Also, which version of Jetty are you using?


Jetty6 but...

>   I don't believe there's a
> way to get component reloading working yet with Eclipse + Jetty6,
> although there is with Eclipse + Jetty5.

...it's working. I just adpated the build path in Eclipse3.3 like this:

Project Properties -> Java Build Path 
Tab Source: added folder src/main/resources
Default output folder for all: projectname/target/classes

Tab Libraries: removed the class folder with the resources directory

Not sure, if this is the common way to do, but it works quite fine.

Greets
Jakob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Getting Answers on the User List

2008-04-12 Thread Yura Tkachenko
There are so many interesting replies over here. As for me I found this list
is very interesting. This is a great place where you can find a lot useful
information. Also if you can ask right question definitely you can get right
answer which is great. Anyway as Java developer my first technology was JSF.
It was not an easy thing to use it especially when you don't have experience
in different Java technologies. But after that I had an opportunity to try
out Tapestry 4. After JSF it was not an easy framework. I mean at that time
I even didn't know what Inversion of Control means as the result it was very
hard to start. And later I had an opportunity to work with Spring (another
IoC) and some things become clear for me (I mean HiveMind concepts). Anyway
Tapestry 4 helped me understood better how JSF works. I know that for
someone it sounds strange but if you look at any book about Tapestry4 or T5
you will found that the first thing each author tried to explain how to pass
data from one page to another and how user can persist data on some page
(e.g. @Persist). In JSF it's a bit tricky since JSF by default don't include
such a useful thing but at the same time Myfaces Tomahawk provides
additional component which does this work. And a few months ago I tried to
use T5. What can I say it's amazing framework and you can build your
applications very easy. Most of all I like such things:
1) T5 allow user to modify Java classes (related to your T5 app) without
restarting app server.
2) No configuration stored in XML
3) Great error handling
4) Easy to create your own components.
Of course, there are a lot of things to enhance. JSF 2.0 will include many
T5 ideas is very great for T5. It is another proof that T5 is a great
framework to develop web applications. But there is one challenge for
beginners is that T5 is based on T5 IoC (which I personally think a good
marriage) as the result if you want to use full power of T5 you need to
understand IoC.

To Rob: I decided to highlight you because you are special person :-). If
you feel that Howard has an ego then try to avoid it. To be honest how you
can feel Howard's ego in this maillist. You can always ask right question
and get right answers and you will never hit Howard's ego. But I must tell
you if you don't know it yet that every person has an ego and even you :-).
But of course, if you are working with Howard (which I'm sure is not true)
then you have always an opportunity to be kind and respect Howard since he
really changed the world of Java Web Application Frameworks. In other words
stop this FUD.

On Fri, Apr 11, 2008 at 9:59 PM, Michael Gerzabek <[EMAIL PROTECTED]>
wrote:

> Howard Lewis Ship schrieb:
>
> > The reality is that right now I'm sitting in an office at Formos and
> > every single person in the building is deriving their living directly
> > from Tapestry and the effort I've put into it over the last seven
> > years.  And that's just the company I work for; Over the last few
> > years, I've trained perhaps 100 developers at many different companies
> > on how to use Tapestry. I'm likely to double that number in the next
> > year ... and that's just the tiny tip of the iceberg of Tapestry users
> > I know about.  I'm excited about what I'm doing now, and I'm excited
> > about everything we have planned going forward.
> >
> >
>
> And that's really a men with a vision. Kudos Howard!!!
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: T5: exception type prefix during onException

2008-04-12 Thread Bill Holloway
Sure, that'll work.  I guess I was wondering if there were a built-in
feature to disable this or if something in the JVM were involved that
I could configure.  I should've worded my question that way!

Thanks!

Bill

On 4/12/08, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
> How about this:
>
>   public static stripExceptionPrefix(String message) {
> return message.substring(message.indexOf(":")).trim();
>   }
>
>  Stick that somewhere and just use that?
>
>  -Filip
>
>
>  On 2008-04-12 05:29, Bill Holloway wrote:
>
> > In using onException, I send the resulting string to a conditionally-shown
> >  on the page.  I notice that every time it's displayed (after an
> > exception), it is prefixed with  a string describing the type of my
> > exception.  So if my message is "database is unreachable", the message
> > displayed on the page is
> >
> > java.lang.Exception:  database is unreachable
> >
> > Is there any way to knock out the prefixing of the exception type?
> >
> >
>
> -
>  To unsubscribe, e-mail:
> [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Bill @ PeoplePad

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Component reloading is not working

2008-04-12 Thread Andy Huhn
Hi Jakob,

Also, which version of Jetty are you using?  I don't believe there's a
way to get component reloading working yet with Eclipse + Jetty6,
although there is with Eclipse + Jetty5.

Andy

On Sat, 2008-04-12 at 13:46 +0200, Jakob Keres wrote:
> Hi.
> 
> I'm quite new to tapestry so it's maybe only a stupid newbie issue.
> 
> I created a new project with (copied from website):
> 
> mvn archetype:create \
>   -DarchetypeGroupId=org.apache.tapestry \
>   -DarchetypeArtifactId=quickstart \
>   -DgroupId=org.apache.tapestry \
>   -DartifactId=tutorial1 \
>   -DpackageName=org.apache.tapestry.tutorial
> 
> So far everything is working as expected, when I edit Start.tml the
> browser output is affected immediately.
> 
> Next I changed Start.tml to
> --Start.tml--
>  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>   My Page Specific Content
> 
> -
> 
> created the path 
> src/main/resources/org/apache/tapestry/tutorial/components
> 
> and added Layout.tml
> --Layout.tml--
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> 
> tutorial1 Start Page
> 
> 
> 
> 
> 
> --
> 
> and Layout.java in 
> src/main/java/org/apache/tapestry/tutorial/components
> 
> --Layout.java--
> package org.apache.tapestry.tutorial.components;
> 
> public class Layout
> {
> }
> ---
> 
> If I now press reload in the browser I get the exception:
>   Unable to resolve 'Layout' to a component class name...
> 
> I noticed
> target/classes/org/apache/tapestry/tutorial/components
> does not exist.
> 
> 
> When I restart Jetty it compiles the new file and the site is working
> again, but changes to Layout.* are still not reflected at runtime.
> 
> So, what do I do wrong?
> 
> Thanks and regards
> Jakob
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



redirect page in pageValidate method

2008-04-12 Thread learn
in my page validate method i use cycle to forward to another page.  I did
"debugging" and it show the code does run fine. but i dont get the resut that i
want. the page doesnt get redirected



public void pageValidate(PageEvent event) {
  if(getUserExists()){
 event.getRequestCycle().activate("HomeMember");
  return;
  
  }
  
  
if(getDistUserExists()){

event.getRequestCycle().activate("HomeDist");
   
  

return;
  
  }

}


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



my Java EE tragic story.

2008-04-12 Thread Mohammad Shamsi
Hi Friends,

please take a look at my blog about Java EE and my problems with it.

http://mhshams.blogspot.com/

-- 
sincerely yours
M. H. Shamsi


Re: Component reloading is not working

2008-04-12 Thread Jakob Keres

Am Samstag, den 12.04.2008, 13:54 +0200 schrieb Filip S. Adamsen:
> Hi Jakob,
> 
> You need to compile after making changes, even if the changes you made 
> does not involve any classes. 

OK.

> Which IDE are you using?

Eclipse - of course :)

Thx, 
Jakob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 : session timeout

2008-04-12 Thread Geoff Callender

Hi Stephane,

I don't think that's a problem - POJOs can be subclasses (after all,  
every class is a subclass indirectly of Object).  What we're talking  
about here is a shared behaviour and it seems to me entirely  
appropriate to put the shared behaviour into a superclass.


It's not the only way to solve the problem, but I do see a couple of  
other benefits this way:
- it can hold state, which can be handy if, for example, you want to  
save the original request while you display a login screen.
- it's very obvious for the maintenance programmer who will follow on  
in the years to come!


Cheers,

Geoff

On 12/04/2008, at 7:19 PM, Stephane Decleire wrote:


Thanks Geoff.

That is the first idea i came up with and i think that it works.
But Howard has worked hard to let us use any simple POJO as  
pages ;-). Is there any other solution to have a common check on the  
pages activation event without extending a common subclass ?


Stephane

Geoff Callender a écrit :

Hi Stephane,

No, you are not wrong.  A common technique is to put session  
checking in a common class which all other pages extend.  Session  
checking can be achieved by checking for the existence of an  
Application State Object that you have set up earlier when  
something significant happened, eg. when user logged in.  Here's an  
example base class (untested):


public class SimpleBasePage {

   @ApplicationState
   private Visit _visit;
   private boolean _visitExists;
   @InjectPage
   private Index _index;
   Object onActivate() {

   if (!isVisitExists()) {
   return _index;
   }

   return null;
   }

   public Visit getVisit() {
   return _visit;
   }

   public boolean isVisitExists() {
   return _visitExists;
   }
}

In this example the _visit can be created simply by calling  
getVisit().  Tapestry's lazy loading of ASO's does the rest.


Make sure you DON'T put your base class in the "pages" package -  
create a new package, eg. "base".


Hope this helps.

Geoff
http://files.doublenegative.com.au/jumpstart/

On 11/04/2008, at 7:57 PM, Stephane Decleire wrote:

I think that i did not explain very well the problem i  
encounter ... so i will try to explain it better (so hard in a  
foreign language ...)


Suppose i have a page A which call a page B after initializing a  
property of B :


[Page A]

@InjectPage
private B b;

@OnEvent (value="action")
Object gotoB() {
 b.setMessage("hello");
 return b;
}

The user is now on the page B with its welcome message. He takes a  
break at the coffee machine. When he comes back, he tries to  
refresh his page. But he has discuss two much time with his  
friends while drinking his coffee and his session has just  
expired ! (the session there is the HTTP session).
For Tapestry, that's mean that a new HTTP session will be created  
for this user and the page B will be rendered one more time as if  
the user was a new one. As a consequence, the content of the  
message property will not be set when the page B is rendered.
In this case, it will just be an inconvenient but if the property  
is an object and not a string and this object is used in the  
rendering of the page B, we will get the awfull "Null pointer  
exception" error !!! :-(
Since, the power of Tapestry is to present the developer "HTML  
pages" as objects, passing data by setting properties from page to  
page is a common pattern and we need to check for the presence of  
our properties in allmost all pages of an application when the  
HTTP session is lost.
In the simplest case, we need to check the existence of the HTTP  
session in allmost all page activation events and redirect the  
user on a specific page when the session as expired !

Am i wrong ?

Stephane

Josh Canfield a écrit :

One approach is to store this data transiently in an ASO.



http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html

"With an ASO, the value is automatically stored outside the page;  
with

the default storage strategy, it is stored in the session. "

Unless you've built a different ASO storage strategy, your value is
going into the session and a session timeout will lose that value  
as

well.

My advice, build your app defensively. Don't depend on objects  
being

available if they are being pulled from the session, or even the
database for that matter. Understand what it means if a session  
times
out at every step of your workflow so you can do the right thing  
when

the object isn't there. Build tests that hit those pages with no
session to verify the behavior.

Good luck!
Josh

On Thu, Apr 10, 2008 at 3:55 AM, Peter Stavrinides
<[EMAIL PROTECTED]> wrote:


Hi Stephane

One approach is to store this data transiently in an ASO. (This  
data object
needs to be serializable though, but using soft references works  
great). In
your getter method be sure to check if its null and if so  
reinitialize
it)... Inject the ASO in your pages and never worry about data  
activation in
pages. T

Re: Component reloading is not working

2008-04-12 Thread Filip S. Adamsen

Hi Jakob,

You need to compile after making changes, even if the changes you made 
does not involve any classes. This is so that the templates etc. can be 
pushed to target/classes where Jetty looks for them.


Which IDE are you using?

-Filip

On 2008-04-12 13:46, Jakob Keres wrote:

Hi.

I'm quite new to tapestry so it's maybe only a stupid newbie issue.

I created a new project with (copied from website):

mvn archetype:create \
  -DarchetypeGroupId=org.apache.tapestry \
  -DarchetypeArtifactId=quickstart \
  -DgroupId=org.apache.tapestry \
  -DartifactId=tutorial1 \
  -DpackageName=org.apache.tapestry.tutorial

So far everything is working as expected, when I edit Start.tml the
browser output is affected immediately.

Next I changed Start.tml to
--Start.tml--
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
  My Page Specific Content

-

created the path 
src/main/resources/org/apache/tapestry/tutorial/components


and added Layout.tml
--Layout.tml--
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>

tutorial1 Start Page





--

and Layout.java in 
src/main/java/org/apache/tapestry/tutorial/components


--Layout.java--
package org.apache.tapestry.tutorial.components;

public class Layout
{
}
---

If I now press reload in the browser I get the exception:
  Unable to resolve 'Layout' to a component class name...

I noticed
target/classes/org/apache/tapestry/tutorial/components
does not exist.


When I restart Jetty it compiles the new file and the site is working
again, but changes to Layout.* are still not reflected at runtime.

So, what do I do wrong?

Thanks and regards
Jakob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Component reloading is not working

2008-04-12 Thread Jakob Keres
Hi.

I'm quite new to tapestry so it's maybe only a stupid newbie issue.

I created a new project with (copied from website):

mvn archetype:create \
  -DarchetypeGroupId=org.apache.tapestry \
  -DarchetypeArtifactId=quickstart \
  -DgroupId=org.apache.tapestry \
  -DartifactId=tutorial1 \
  -DpackageName=org.apache.tapestry.tutorial

So far everything is working as expected, when I edit Start.tml the
browser output is affected immediately.

Next I changed Start.tml to
--Start.tml--
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
  My Page Specific Content

-

created the path 
src/main/resources/org/apache/tapestry/tutorial/components

and added Layout.tml
--Layout.tml--
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>

tutorial1 Start Page





--

and Layout.java in 
src/main/java/org/apache/tapestry/tutorial/components

--Layout.java--
package org.apache.tapestry.tutorial.components;

public class Layout
{
}
---

If I now press reload in the browser I get the exception:
  Unable to resolve 'Layout' to a component class name...

I noticed
target/classes/org/apache/tapestry/tutorial/components
does not exist.


When I restart Jetty it compiles the new file and the site is working
again, but changes to Layout.* are still not reflected at runtime.

So, what do I do wrong?

Thanks and regards
Jakob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Index page context and 404 response

2008-04-12 Thread Imants Firsts
Hello!

I changed my application to use the Index.tml instead
of Start.tml, because pagelink component for index page
renders www.mydomain.com/, which looks much better than
www.mydomain.com/start 

However now there is a problem that all the invalid
tapestry URLs are rendered as my index page with
everything that comes after mydomain.com/ treated as
context to the index page.

I would like to render the standard 404 http response
for invalid URLs or pass them through to servlet
container to return 404. Is this possible with index pages?

Thanks in advance,
Imants


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 : session timeout

2008-04-12 Thread Filip S. Adamsen

Hi,

Yes, there is another solution. Use request filters:
http://www.mail-archive.com/users@tapestry.apache.org/msg21568.html

I use this approach. I check for an annotation on my page class in my 
filters and act accordingly.


-Filip

On 2008-04-12 11:19, Stephane Decleire wrote:

Thanks Geoff.

That is the first idea i came up with and i think that it works.
But Howard has worked hard to let us use any simple POJO as pages ;-). 
Is there any other solution to have a common check on the pages 
activation event without extending a common subclass ?


Stephane

Geoff Callender a écrit :

Hi Stephane,

No, you are not wrong.  A common technique is to put session checking 
in a common class which all other pages extend.  Session checking can 
be achieved by checking for the existence of an Application State 
Object that you have set up earlier when something significant 
happened, eg. when user logged in.  Here's an example base class 
(untested):


public class SimpleBasePage {

@ApplicationState
private Visit _visit;
private boolean _visitExists;
@InjectPage
private Index _index;
Object onActivate() {

if (!isVisitExists()) {
return _index;
}

return null;
}

public Visit getVisit() {
return _visit;
}

public boolean isVisitExists() {
return _visitExists;
}
}

In this example the _visit can be created simply by calling 
getVisit().  Tapestry's lazy loading of ASO's does the rest.


Make sure you DON'T put your base class in the "pages" package - 
create a new package, eg. "base".


Hope this helps.

Geoff
http://files.doublenegative.com.au/jumpstart/

On 11/04/2008, at 7:57 PM, Stephane Decleire wrote:

I think that i did not explain very well the problem i encounter ... 
so i will try to explain it better (so hard in a foreign language ...)


Suppose i have a page A which call a page B after initializing a 
property of B :


[Page A]

@InjectPage
private B b;

@OnEvent (value="action")
Object gotoB() {
  b.setMessage("hello");
  return b;
}

The user is now on the page B with its welcome message. He takes a 
break at the coffee machine. When he comes back, he tries to refresh 
his page. But he has discuss two much time with his friends while 
drinking his coffee and his session has just expired ! (the session 
there is the HTTP session).
For Tapestry, that's mean that a new HTTP session will be created for 
this user and the page B will be rendered one more time as if the 
user was a new one. As a consequence, the content of the message 
property will not be set when the page B is rendered.
In this case, it will just be an inconvenient but if the property is 
an object and not a string and this object is used in the rendering 
of the page B, we will get the awfull "Null pointer exception" error 
!!! :-(
Since, the power of Tapestry is to present the developer "HTML pages" 
as objects, passing data by setting properties from page to page is a 
common pattern and we need to check for the presence of our 
properties in allmost all pages of an application when the HTTP 
session is lost.
In the simplest case, we need to check the existence of the HTTP 
session in allmost all page activation events and redirect the user 
on a specific page when the session as expired !

Am i wrong ?

Stephane

Josh Canfield a écrit :

One approach is to store this data transiently in an ASO.



http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html

"With an ASO, the value is automatically stored outside the page; with
the default storage strategy, it is stored in the session. "

Unless you've built a different ASO storage strategy, your value is
going into the session and a session timeout will lose that value as
well.

My advice, build your app defensively. Don't depend on objects being
available if they are being pulled from the session, or even the
database for that matter. Understand what it means if a session times
out at every step of your workflow so you can do the right thing when
the object isn't there. Build tests that hit those pages with no
session to verify the behavior.

Good luck!
Josh

On Thu, Apr 10, 2008 at 3:55 AM, Peter Stavrinides
<[EMAIL PROTECTED]> wrote:


Hi Stephane

One approach is to store this data transiently in an ASO. (This 
data object
needs to be serializable though, but using soft references works 
great). In

your getter method be sure to check if its null and if so reinitialize
it)... Inject the ASO in your pages and never worry about data 
activation in

pages. This is the real value of IoC. However, bear in mind when using
persisted data if it becomes large, it gets expensive to carry 
around in a

high volume application, so you loose scalability.



Stephane Decleire wrote:


Hi,

I would like to know how do you handle session timeout with T5 or 
if there



is a "design pattern" for this case.

When a session timeout occurs, a lot of pages won't work because 
of a la

Re: Problem with AbstractIntegrationTestSuite

2008-04-12 Thread Filip S. Adamsen

Hi,

webdefault.xml is the web.xml for your test application, so you need to 
provide one and set the tapestry.app-package context parameter etc.


-Filip

On 2008-04-12 12:47, Stellit wrote:
I have wrote a simple test with AbstractIntegrationTestSuite and selenium. 
I run my test with TestNG within eclipse, but I got the folloing message all

the time.

^^
Starting Jetty instance on port  (/ mapped to
/Users/stellit/Documents/workspace/ajax-test/src/main/webapp)
[WARN] WebApplicationContext Configuration error on
/Users/stellit/Documents/workspace/ajax-test/src/main/webapp
java.io.FileNotFoundException:
/Users/stellit/Documents/workspace/ajax-test/src/test/conf/webdefault.xml
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
^^^
My Test Class looks like this:


package org.hamster.loginapp.test.ajax;

import org.apache.tapestry.test.AbstractIntegrationTestSuite;
import org.testng.annotations.Test;

public class HelloTest extends AbstractIntegrationTestSuite {
public HelloTest() {
super("/src/main/webapp");
}

 @Test
 public void integration_test() throws Exception {
 open(BASE_URL);
 assertTextPresent("Tapestry");
 }

}


Why it always finds webdefault.xml? How should I fix this?


regard, 
stellit


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to override a service create with @Marker

2008-04-12 Thread Robin Helgelin
On Tue, Apr 8, 2008 at 7:24 PM, Robin Helgelin <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 8, 2008 at 7:07 PM, Dave Dombrosky <[EMAIL PROTECTED]> wrote:
>  > Is there still no solution to this problem?  I am also trying to
>  >  override the default SaltSource, but the tapestry5-acegi package
>  >  always wants to use the one it defines.
>  >
>  >  I tried using contributions to Alias and AliasOverrides, and also
>  >  annotating my own buildMySaltSource() method with
>  >  @Marker(AcegiServices.class), but nothing seems to work.
>
>  Yes, I'll have a solution for this, I'll have a new 1.0.4-SNAPSHOT out
>  in a day or two that fixes this.

Ok, here we go. I've uploaded a 1.1.0-SNAPSHOT which fixes the problem
by introducing a new interface that only extends the acegi SaltSource
interface. I'll leave it as a snapshot for a few days, then I'll
release the 1.1.0 release.

>From my example project:
public static void bind(ServiceBinder binder) {
binder.bind(SaltSourceService.class,
SaltSourceImpl.class).withId("MySaltSource");
}

public static SaltSourceService buildMySaltSource() throws Exception {
SaltSourceImpl saltSource = new SaltSourceImpl();
saltSource.setSystemWideSalt("BBEEF");
saltSource.afterPropertiesSet();
return saltSource;
}

public static void
contributeAliasOverrides(@InjectService("MySaltSource")
SaltSourceService saltSource,
Configuration configuration) {
configuration.add(AliasContribution.create(SaltSourceService.class,
saltSource));
}

-- 
 regards,
 Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: exception type prefix during onException

2008-04-12 Thread Filip S. Adamsen

How about this:

  public static stripExceptionPrefix(String message) {
return message.substring(message.indexOf(":")).trim();
  }

Stick that somewhere and just use that?

-Filip

On 2008-04-12 05:29, Bill Holloway wrote:

In using onException, I send the resulting string to a conditionally-shown
 on the page.  I notice that every time it's displayed (after an
exception), it is prefixed with  a string describing the type of my
exception.  So if my message is "database is unreachable", the message
displayed on the page is

java.lang.Exception:  database is unreachable

Is there any way to knock out the prefixing of the exception type?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with AbstractIntegrationTestSuite

2008-04-12 Thread Stellit

I have wrote a simple test with AbstractIntegrationTestSuite and selenium. 
I run my test with TestNG within eclipse, but I got the folloing message all
the time.

^^
Starting Jetty instance on port  (/ mapped to
/Users/stellit/Documents/workspace/ajax-test/src/main/webapp)
[WARN] WebApplicationContext Configuration error on
/Users/stellit/Documents/workspace/ajax-test/src/main/webapp
java.io.FileNotFoundException:
/Users/stellit/Documents/workspace/ajax-test/src/test/conf/webdefault.xml
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
^^^
My Test Class looks like this:


package org.hamster.loginapp.test.ajax;

import org.apache.tapestry.test.AbstractIntegrationTestSuite;
import org.testng.annotations.Test;

public class HelloTest extends AbstractIntegrationTestSuite {
public HelloTest() {
super("/src/main/webapp");
}

 @Test
 public void integration_test() throws Exception {
 open(BASE_URL);
 assertTextPresent("Tapestry");
 }

}


Why it always finds webdefault.xml? How should I fix this?


regard, 
stellit
-- 
View this message in context: 
http://www.nabble.com/Problem-with-AbstractIntegrationTestSuite-tp16648401p16648401.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 : session timeout

2008-04-12 Thread Stephane Decleire

Thanks Josh,

I think that your solution is the best but also the hardest way ! 
Checking every properties in every pages ... wooahh !
Would not it be very handy to have the framework raise an event in case 
of a session loss (for example as for a 404 error) that we could catch 
to simply redirect to a specific page or to further investigate and 
check properties like in your solution for specific pages ?


Stephane

Josh Canfield a écrit :

Hey Stephane,

  

I think that i did not explain very well the problem i encounter ... so i
will try to explain it better (so hard in a foreign language ...)



I understood the problem, sorry if my answer didn't give you what you needed :)

  

In this case, it will just be an inconvenient but if the property is an
object and not a string and this object is used in the rendering of the page
B, we will get the awfull "Null pointer exception" error !!! :-(



The basic pattern would be to check your state in one of your
onActivate methods and redirect or proceed based on your requirements.
activation events are called in order of name, then number of
properties so you can pick whether your activation happens before or
after your general activation occurs.

@OnEvent("activate")
public Object _onActivate() {
// to run before other activation handlers
// check @Persist properties
}

If this is a common property between a set of pages then you can
consider creating a base class with it's own activation handler to
consolidate your property validation. If the property is invalid
(null, incomplete, etc) you can do the right thing for your pages
whether that is redirecting to another page, initialize the object
somehow or something else. In some cases, like message, do nothing is
probably an ok answer.

  

In the simplest case, we need to check the existence of the HTTP session in
allmost all page activation events and redirect the user on a specific page
when the session as expired !



I wouldn't check for the existence of the HTTP session, I'd actually
validate the individual properties in the page. This is what I mean by
programming defensively. You can't infer that if a session exists, or
even that one of your properties is set, that all of your properties
are safe, who knows how your user got to the page, or how your
co-worker wrote his page that is linking to yours.

Josh

On Fri, Apr 11, 2008 at 2:57 AM, Stephane Decleire
<[EMAIL PROTECTED]> wrote:
  

I think that i did not explain very well the problem i encounter ... so i
will try to explain it better (so hard in a foreign language ...)

Suppose i have a page A which call a page B after initializing a property of
B :

[Page A]

@InjectPage
private B b;

@OnEvent (value="action")
Object gotoB() {
  b.setMessage("hello");
  return b;
}

The user is now on the page B with its welcome message. He takes a break at
the coffee machine. When he comes back, he tries to refresh his page. But he
has discuss two much time with his friends while drinking his coffee and his
session has just expired ! (the session there is the HTTP session).
For Tapestry, that's mean that a new HTTP session will be created for this
user and the page B will be rendered one more time as if the user was a new
one. As a consequence, the content of the message property will not be set
when the page B is rendered.
In this case, it will just be an inconvenient but if the property is an
object and not a string and this object is used in the rendering of the page
B, we will get the awfull "Null pointer exception" error !!! :-(
Since, the power of Tapestry is to present the developer "HTML pages" as
objects, passing data by setting properties from page to page is a common
pattern and we need to check for the presence of our properties in allmost
all pages of an application when the HTTP session is lost.
In the simplest case, we need to check the existence of the HTTP session in
allmost all page activation events and redirect the user on a specific page
when the session as expired !
Am i wrong ?

Stephane

Josh Canfield a écrit :




One approach is to store this data transiently in an ASO.




http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html

"With an ASO, the value is automatically stored outside the page; with
the default storage strategy, it is stored in the session. "

Unless you've built a different ASO storage strategy, your value is
going into the session and a session timeout will lose that value as
well.

My advice, build your app defensively. Don't depend on objects being
available if they are being pulled from the session, or even the
database for that matter. Understand what it means if a session times
out at every step of your workflow so you can do the right thing when
the object isn't there. Build tests that hit those pages with no
session to verify the behavior.

Good luck!
Josh

On Thu, Apr 10, 2008 at 3:55 AM, Peter Stavrinides
<[EMAIL PROTECTED]> wrote:


  

Hi Stephane

One app

Re: T5 : session timeout

2008-04-12 Thread Stephane Decleire

Thanks Geoff.

That is the first idea i came up with and i think that it works.
But Howard has worked hard to let us use any simple POJO as pages ;-). 
Is there any other solution to have a common check on the pages 
activation event without extending a common subclass ?


Stephane

Geoff Callender a écrit :

Hi Stephane,

No, you are not wrong.  A common technique is to put session checking 
in a common class which all other pages extend.  Session checking can 
be achieved by checking for the existence of an Application State 
Object that you have set up earlier when something significant 
happened, eg. when user logged in.  Here's an example base class 
(untested):


public class SimpleBasePage {

@ApplicationState
private Visit _visit;
private boolean _visitExists;

@InjectPage

private Index _index;

Object onActivate() {


if (!isVisitExists()) {
return _index;
}

return null;
}

public Visit getVisit() {
return _visit;
}

public boolean isVisitExists() {
return _visitExists;
}
}

In this example the _visit can be created simply by calling 
getVisit().  Tapestry's lazy loading of ASO's does the rest.


Make sure you DON'T put your base class in the "pages" package - 
create a new package, eg. "base".


Hope this helps.

Geoff
http://files.doublenegative.com.au/jumpstart/

On 11/04/2008, at 7:57 PM, Stephane Decleire wrote:

I think that i did not explain very well the problem i encounter ... 
so i will try to explain it better (so hard in a foreign language ...)


Suppose i have a page A which call a page B after initializing a 
property of B :


[Page A]

@InjectPage
private B b;

@OnEvent (value="action")
Object gotoB() {
  b.setMessage("hello");
  return b;
}

The user is now on the page B with its welcome message. He takes a 
break at the coffee machine. When he comes back, he tries to refresh 
his page. But he has discuss two much time with his friends while 
drinking his coffee and his session has just expired ! (the session 
there is the HTTP session).
For Tapestry, that's mean that a new HTTP session will be created for 
this user and the page B will be rendered one more time as if the 
user was a new one. As a consequence, the content of the message 
property will not be set when the page B is rendered.
In this case, it will just be an inconvenient but if the property is 
an object and not a string and this object is used in the rendering 
of the page B, we will get the awfull "Null pointer exception" error 
!!! :-(
Since, the power of Tapestry is to present the developer "HTML pages" 
as objects, passing data by setting properties from page to page is a 
common pattern and we need to check for the presence of our 
properties in allmost all pages of an application when the HTTP 
session is lost.
In the simplest case, we need to check the existence of the HTTP 
session in allmost all page activation events and redirect the user 
on a specific page when the session as expired !

Am i wrong ?

Stephane

Josh Canfield a écrit :

One approach is to store this data transiently in an ASO.



http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html

"With an ASO, the value is automatically stored outside the page; with
the default storage strategy, it is stored in the session. "

Unless you've built a different ASO storage strategy, your value is
going into the session and a session timeout will lose that value as
well.

My advice, build your app defensively. Don't depend on objects being
available if they are being pulled from the session, or even the
database for that matter. Understand what it means if a session times
out at every step of your workflow so you can do the right thing when
the object isn't there. Build tests that hit those pages with no
session to verify the behavior.

Good luck!
Josh

On Thu, Apr 10, 2008 at 3:55 AM, Peter Stavrinides
<[EMAIL PROTECTED]> wrote:


Hi Stephane

One approach is to store this data transiently in an ASO. (This 
data object
needs to be serializable though, but using soft references works 
great). In

your getter method be sure to check if its null and if so reinitialize
it)... Inject the ASO in your pages and never worry about data 
activation in

pages. This is the real value of IoC. However, bear in mind when using
persisted data if it becomes large, it gets expensive to carry 
around in a

high volume application, so you loose scalability.



Stephane Decleire wrote:


Hi,

I would like to know how do you handle session timeout with T5 or 
if there



is a "design pattern" for this case.

When a session timeout occurs, a lot of pages won't work because 
of a lack


of data (for example, normaly setted before returning the page). So 
i need
to write a piece of code in the activation event of almost of my 
pages. In
T4, i would have writen it in a parent page and would have 
subclassed all
the pages from it. In T5 should i consider writi