You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cherry Development <av...@cherrydev.com> on 2003/11/11 00:07:12 UTC
Accessing the engine from the Monitor Extension.
I'm trying to set up a monitor extension that will allow me to
implement the 'long session' programming pattern for Hibernate, where a
single hibernate session is used for an entire user session in a
servlet. This requires that the hibernate session is attached and
detached at the beginning and end of each cycle. I figured a Monitor
extension might be a good place to implement such behavior.
The trouble I'm having, though, is that I can't seem to figure out how
to get access to a global object from within the extension. The
IMonitorFactory get passed a RequestContext when a monitor is requested
from it. I can access the ApplicationServlet from there, but the
ApplicationServlet is extremely opaque (access-wise) and won't let me
access to an engine so I can fetch the global object.
I'd handle this directly from the interface methods of IMonitor, except
that they are all passed Strings, thus not giving me access to the
pages whos lifecycle events they're monitoring.
I originally was going to use PageRender/DetachListeners to handle
this, but the events are not nearly as fine-grained as the ones in
IMonitor.
Ideas? Suggestions?
Avi
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Tapestry And AspectJ
Posted by Luke Renn <lu...@imapmail.org>.
Ahhh. Interesting. I was just checking out the java assist page.
Looks like getting aspectj to work with javassist might be impossible
:) It might not be though. If I had a page called Home, how would
tapestry name the subclass it creates at runtime? Is it a true subclass
(would <javasssist created class> instanceof Home return true?) or is it
some new class copied from the original?
Thanks (for the quick response and tapesty),
Luke
Howard M. Lewis Ship wrote:
>I haven't used AspectJ yet.
>
>Tapestry uses Javassist to create enhanced subclasses at runtime. I suspect AspectJ (which does it
>own bit of bytecode weaving magic) expects to be last on the chain, and doesn't like it that classes
>are being created at runtime ... after the point where it gets a chance to rework the code to slip
>in the aspect implementations.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>http://jakarta.apache.org/commons/sandbox/hivemind/
>http://javatapestry.blogspot.com
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
DateField exception with format
Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi,
I can't seem to get the DateField component to work when I bind a format.
The following exception is thrown.
Illegal pattern character 'j'
java.text.SimpleDateFormat.compile(SimpleDateFormat.java:675)
java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:494)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:443)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:424)
org.apache.tapestry.form.DatePicker.renderComponent(DatePicker.java:143)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:880)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:657)
org.apache.tapestry.form.Form.renderComponent(Form.java:396)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:880)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:657)
org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:86
)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:880)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:657)
org.apache.tapestry.html.Body.renderComponent(Body.java:310)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:880)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:657)
org.apache.tapestry.html.Shell.renderComponent(Shell.java:173)
The SimpleFormat seems to work fine in Inserts......
public static final SimpleDateFormat DATE_FORMAT_WITH_SLASHES =
new SimpleDateFormat("MM/dd/yyyy");
Anyone know why this is happening?
Thanks,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Tapestry And AspectJ
Posted by Luke Renn <lu...@imapmail.org>.
It works fine with Tapestry. I'm ashamed to say my pointcut was at
"call" not "execution". Since my code never explicitly called anything
in Home, the aspect never ran. :( Just make sure you use Classname+
(all classes that extend Classname) when writing tapestry aspects.
Thanks,
Luke
Adam Greene wrote:
>AspectJ is actually a Java Compiler and marks up the classes.
>
>-----Original Message-----
>From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
>Sent: Monday, November 10, 2003 11:11 PM
>To: 'Tapestry users'
>Subject: RE: Tapestry And AspectJ
>
>
>I haven't used AspectJ yet.
>
>Tapestry uses Javassist to create enhanced subclasses at runtime. I suspect
>AspectJ (which does it
>own bit of bytecode weaving magic) expects to be last on the chain, and
>doesn't like it that classes
>are being created at runtime ... after the point where it gets a chance to
>rework the code to slip
>in the aspect implementations.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>http://jakarta.apache.org/commons/sandbox/hivemind/
>http://javatapestry.blogspot.com
>
>
>
>>-----Original Message-----
>>From: Luke Renn [mailto:lukerenn@imapmail.org]
>>Sent: Monday, November 10, 2003 10:01 PM
>>To: Tapestry users
>>Subject: Tapestry And AspectJ
>>
>>
>>Hello All,
>>
>>First, thanks to the contributors of this list for the great reading,
>>and thanks to the developers of Tapestry for a great framework.
>>
>>Now, does anyone know the specifics of how tapestry creates
>>subclasses
>>of pages (and engines?). If i setup an aspect to do a
>>System.out.println() in Home.getUserName(), the aspect never gets
>>called. Oddly enough, if I make Home.getUserName() call
>>Home.test() and
>>setup an aspect for test(), that aspect does get called.
>>Anyone got any
>>ideas?
>>
>>Thanks.
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Tapestry And AspectJ
Posted by Adam Greene <ag...@romulin.com>.
AspectJ is actually a Java Compiler and marks up the classes.
-----Original Message-----
From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
Sent: Monday, November 10, 2003 11:11 PM
To: 'Tapestry users'
Subject: RE: Tapestry And AspectJ
I haven't used AspectJ yet.
Tapestry uses Javassist to create enhanced subclasses at runtime. I suspect
AspectJ (which does it
own bit of bytecode weaving magic) expects to be last on the chain, and
doesn't like it that classes
are being created at runtime ... after the point where it gets a chance to
rework the code to slip
in the aspect implementations.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com
> -----Original Message-----
> From: Luke Renn [mailto:lukerenn@imapmail.org]
> Sent: Monday, November 10, 2003 10:01 PM
> To: Tapestry users
> Subject: Tapestry And AspectJ
>
>
> Hello All,
>
> First, thanks to the contributors of this list for the great reading,
> and thanks to the developers of Tapestry for a great framework.
>
> Now, does anyone know the specifics of how tapestry creates
> subclasses
> of pages (and engines?). If i setup an aspect to do a
> System.out.println() in Home.getUserName(), the aspect never gets
> called. Oddly enough, if I make Home.getUserName() call
> Home.test() and
> setup an aspect for test(), that aspect does get called.
> Anyone got any
> ideas?
>
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Tapestry And AspectJ
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
I haven't used AspectJ yet.
Tapestry uses Javassist to create enhanced subclasses at runtime. I suspect AspectJ (which does it
own bit of bytecode weaving magic) expects to be last on the chain, and doesn't like it that classes
are being created at runtime ... after the point where it gets a chance to rework the code to slip
in the aspect implementations.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com
> -----Original Message-----
> From: Luke Renn [mailto:lukerenn@imapmail.org]
> Sent: Monday, November 10, 2003 10:01 PM
> To: Tapestry users
> Subject: Tapestry And AspectJ
>
>
> Hello All,
>
> First, thanks to the contributors of this list for the great reading,
> and thanks to the developers of Tapestry for a great framework.
>
> Now, does anyone know the specifics of how tapestry creates
> subclasses
> of pages (and engines?). If i setup an aspect to do a
> System.out.println() in Home.getUserName(), the aspect never gets
> called. Oddly enough, if I make Home.getUserName() call
> Home.test() and
> setup an aspect for test(), that aspect does get called.
> Anyone got any
> ideas?
>
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Tapestry And AspectJ
Posted by Luke Renn <lu...@imapmail.org>.
Hello All,
First, thanks to the contributors of this list for the great reading,
and thanks to the developers of Tapestry for a great framework.
Now, does anyone know the specifics of how tapestry creates subclasses
of pages (and engines?). If i setup an aspect to do a
System.out.println() in Home.getUserName(), the aspect never gets
called. Oddly enough, if I make Home.getUserName() call Home.test() and
setup an aspect for test(), that aspect does get called. Anyone got any
ideas?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Accessing the engine from the Monitor Extension.
Posted by John Meredith <ps...@t-online.de>.
Hi Avi,
Have a look at the "Open Session in View" pattern on Hibernate's site.
It uses a Filter to create the SessionFactory, and open/get a
ThreadLocal session when required.
URL is: http://www.hibernate.org/43.html
Another approach I've been looking at is the Hibernate wrapper utils
from the Spring Framework (ignore the web stuff) ... very easy to set
things up via an xml config file. No messing around with the
hibernate.cfg.xml, Spring takes care of everything, plus you get a lot
of other neat utils as well. If I understand it correctly, Hivemind will
be able to provide similar things once it's integrated into Tapestry.
Hope this helps.
- John
On Tue, 2003-11-11 at 00:07, Cherry Development wrote:
> I'm trying to set up a monitor extension that will allow me to
> implement the 'long session' programming pattern for Hibernate, where a
> single hibernate session is used for an entire user session in a
> servlet. This requires that the hibernate session is attached and
> detached at the beginning and end of each cycle. I figured a Monitor
> extension might be a good place to implement such behavior.
>
> The trouble I'm having, though, is that I can't seem to figure out how
> to get access to a global object from within the extension. The
> IMonitorFactory get passed a RequestContext when a monitor is requested
> from it. I can access the ApplicationServlet from there, but the
> ApplicationServlet is extremely opaque (access-wise) and won't let me
> access to an engine so I can fetch the global object.
>
> I'd handle this directly from the interface methods of IMonitor, except
> that they are all passed Strings, thus not giving me access to the
> pages whos lifecycle events they're monitoring.
>
> I originally was going to use PageRender/DetachListeners to handle
> this, but the events are not nearly as fine-grained as the ones in
> IMonitor.
>
> Ideas? Suggestions?
>
> Avi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
--
John Meredith <ps...@t-online.de>