Cocoon and Java

View: New views
11 Messages — Rating Filter:   Alert me  

Cocoon and Java

by Matteo Mancini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi all,
I need to know something about the best way to interact with Cocoon object via java code.
More exactly I need to retrieve the Session Object in order to set and get attributes.
 
I tried some ways I found inside cocoon user guide but I faced many problems because 
Cocoon java packages have so many interfaces and classes. tried those dealing with HttpSession, HttpServlet and CocoonServlet classes.
Noone seems to work. I always catch a NullPointerException when I tried to get a reference or instantiate them.
There should be somethng I miss !!!!
 
Can anyone suggest me how to do?
 
 
Thanks in advance
 
Matteo Mancini

Re: Cocoon and Java

by Upayavira-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matteo Mancini wrote:

> Hi all,
> I need to know something about the best way to interact with Cocoon
> object via java code.
> More exactly I need to retrieve the Session Object in order to set and
> get attributes.
>  
> I tried some ways I found inside cocoon user guide but I faced
> many problems because
> Cocoon java packages have so many interfaces and classes. I tried those
> dealing with HttpSession, HttpServlet and CocoonServlet classes.
> Noone seems to work. I always catch a NullPointerException when I tried
> to get a reference or instantiate them.
> There should be somethng I miss !!!!
>  
> Can anyone suggest me how to do?

Firstly, ask on the Cocoon user's list, you'll get better answers there.

Secondly, I'd suggest you state from where you want to get hold of your
session. From flowscript? Within actions? Then people can advise you on
the best approach.

Regards, Upayavira

Re: Cocoon and Java

by Irv Salisbury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are many ways at getting to the Session.  If you are in Java
code, and are in a transformer, etc as part of your setup call you
will be passed a Map that is the object model.  You can then use the
org.apache.cocoon.environment.ObjectModelHelper to get at the Request,
Session, etc.

Also, within flowscript you can use the cocoon.session and
cocoon.request variables.

Irv


On 6/27/05, Matteo Mancini <m.mancini@...> wrote:

>  
>  
> Hi all,
> I need to know something about the best way to interact with Cocoon object
> via java code.
> More exactly I need to retrieve the Session Object in order to set and get
> attributes.
>  
> I tried some ways I found inside cocoon user guide but I faced many problems
> because  
> Cocoon java packages have so many interfaces and classes. I tried those
> dealing with HttpSession, HttpServlet and CocoonServlet classes.
> Noone seems to work. I always catch a NullPointerException when I tried to
> get a reference or instantiate them.
> There should be somethng I miss !!!!
>  
> Can anyone suggest me how to do?
>  
>  
> Thanks in advance
>  
> Matteo Mancini

Re: Cocoon and Java

by Mark Lundquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2005-06-27 07:19:08 -0700, "Matteo Mancini" <m.mancini@...> said:

> I need to know something about the best way to interact with Cocoon =
> object via java code.
> More exactly I need to retrieve the Session Object in order to set and =
> get attributes.

Hi Mateo,

The best way (IM...HO of course ;-) is to implement the 'controller'
aspect of your application in Flowscript (Rhino Javascript with
continuations... built in to Cocoon).

Salient points:

[1] Since it's Rhino, you have LiveConnect, i.e. Java classes & objects
accessible from flowscript;

[2] In flowscript, you don't have to mess with any Session Object.  If
you write

        var foo;

at the global scope, then foo automatically is attached to the session.

[3] Session variable considerations aside, flowscript is a fun, cool
and productive way to do Cocoon applications.

have fun,
?ml?



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


Re: Cocoon and Java

by Sylvain Wallez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Lundquist wrote:

> On 2005-06-27 07:19:08 -0700, "Matteo Mancini"
> <m.mancini@...> said:
>
>> I need to know something about the best way to interact with Cocoon =
>> object via java code.
>> More exactly I need to retrieve the Session Object in order to set and =
>> get attributes.
>
>
> Hi Mateo,
>
> The best way (IM...HO of course ;-) is to implement the 'controller'
> aspect of your application in Flowscript (Rhino Javascript with
> continuations... built in to Cocoon).
>
> Salient points:
>
> [1] Since it's Rhino, you have LiveConnect, i.e. Java classes &
> objects accessible from flowscript;
>
> [2] In flowscript, you don't have to mess with any Session Object.  If
> you write
>
>     var foo;
>
> at the global scope, then foo automatically is attached to the session.
>
> [3] Session variable considerations aside, flowscript is a fun, cool
> and productive way to do Cocoon applications.


A very good summary :-)

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


[Q] New JavaFlow alternative?

by Geert Josten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Just a thought: the nice thing about FlowScript is that it is 'compiled' at runtime, but can't that
be done with JavaFlow (or something like that) as well? The JSP engines compile the java code also
at runtime, so why not? This way changing the code will no longer require a restart/redeploy of the
servlet and you still have type checking at your disposal. Makes development easier..

Cheers,
Geert

Re: [Q] New JavaFlow alternative?

by Reinhard Pötz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Geert Josten wrote:
> Hi all,
>
> Just a thought: the nice thing about FlowScript is that it is 'compiled'
> at runtime, but can't that be done with JavaFlow (or something like
> that) as well? The JSP engines compile the java code also at runtime, so
> why not? This way changing the code will no longer require a
> restart/redeploy of the servlet and you still have type checking at your
> disposal. Makes development easier..

you know what, it's already available (in trunk) ;-)

--
Reinhard P?tz           Independent Consultant, Trainer & (IT)-Coach

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: [Q] New JavaFlow alternative?

by Geert Josten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great!

But.. what do I look for?

G.

Reinhard Poetz wrote:

> Geert Josten wrote:
>
>> Hi all,
>>
>> Just a thought: the nice thing about FlowScript is that it is
>> 'compiled' at runtime, but can't that be done with JavaFlow (or
>> something like that) as well? The JSP engines compile the java code
>> also at runtime, so why not? This way changing the code will no longer
>> require a restart/redeploy of the servlet and you still have type
>> checking at your disposal. Makes development easier..
>
>
> you know what, it's already available (in trunk) ;-)
>

--
Geert.Josten@...
IT-consultant at Daidalos BV, Bleiswijk (NL)

http://www.daidalos.nl/
tel:+31-(0)10-850 12 00
fax:+31-(0)10-850 11 99

GPG: 1024D/12DEBB50

Re: [Q] New JavaFlow alternative?

by Torsten Curdt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> But.. what do I look for?

Well ...javaflow :)

There are a couple of different
ways to use it though.

 o rewrite at build time
 o rewrite through jci (autocompiling)
 o rewrite through eclipse

As long as the classpath is registered
in the sitemap it will automagically
reload the classes.

I personally would prefer the eclipse
way ...but jci might the be the way
for a deployed system.

Please note that the cforms integration
still needs to be ported from the 2.1
branch into trunk.

Let me know if you need further help

cheers
--
Torsten


signature.asc (193 bytes) Download Attachment

Compiling Classloader (was Re: [Q] New JavaFlow alternative?)

by Mark Lundquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2005-06-28 05:43:32 -0700, Reinhard Poetz <reinhard@...> said:

> Geert Josten wrote:
>> Hi all,
>>
>> Just a thought: the nice thing about FlowScript is that it is
>> 'compiled' at runtime, but can't that be done with JavaFlow (or
>> something like that) as well? The JSP engines compile the java code
>> also at runtime, so why not? This way changing the code will no longer
>> require a restart/redeploy of the servlet and you still have type
>> checking at your disposal. Makes development easier..
>
> you know what, it's already available (in trunk) ;-)

Whatever happened to the compiling classloader?  I used that all the
time back in 2.1.4, and then I guess it went away?  The comments
explaining this for <reload-scripts> in cocoon.xconf have been removed
since then.  However, the docs still talk about it
(http://cocoon.apache.org/2.1/userdocs/flow/java.html#Dynamic+Compilation).

I

miss it :-(.

What is the deal with that, anyway?

cheers,
?ml?



Re: Compiling Classloader (was Re: [Q] New JavaFlow alternative?)

by Torsten Curdt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I miss it :-(.

Maybe have a look into jci

http://jakarta.apache.org/commons/sandbox/jci/

cheers
--
Torsten


signature.asc (193 bytes) Download Attachment