You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Paul Pattison <pa...@76design.com> on 2002/07/04 19:11:40 UTC

Is this an action?

Hi all,

I'm writing a small web app that at one stage needs to take the input from a
textarea, parse it in a special way and then store it in the database.

What's the best way for me to do this?  I was thinking that I should write
my own custom Action to do this.  Any thoughts?

Thanks,

Paul


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Is this an action?

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 04.Jul.2002 -- 01:11 PM, Paul Pattison wrote:
> Hi all,
> 
> I'm writing a small web app that at one stage needs to take the input from a
> textarea, parse it in a special way and then store it in the database.
> 
> What's the best way for me to do this?  I was thinking that I should write
> my own custom Action to do this.  Any thoughts?

I would suggest to leverage the existing components, i.e. DatabaseActions.
With the traditional ones (2.0.x) you could get away with writing an action
that parses the data, stores it in a request attribute and let a DatabaseAction
to the job.
With the DatabaseActions from the modular package (scratchpad in 2.0.[23], or
2.1) you would need to write an InputModule for the parsing.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Accessing SunShine context from Java Action

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Hugo Burm wrote:
>
> Hello,
>
> Thanks to Carsten Ziegeler, my SunShine autorization and context
> is working
> fine now.
> Now I want to access the SunShine context from my own Java handler (an
> Action).
>
> I looked into the SunShine sources and tried to call the most simpe call
> (check whether a SunShine context exists)
> Something like this:
>
> import org.apache.cocoon.sunshine.*;
> [...]
> SunShine sSun  = new SunShine();
> boolean bSun = sSun.existsContext("survey");
> [...]
>
SunShine is an Avalon component, you can't instantiate it directly, but
you have to lookup it using a component manager. If your action inherits
from ComposableAction you already have a component manager.
Then you can lookup the SunShine component:

   SunShine sSun  = this.manager.lookup(SunShine.ROLE);

and use it. But don't forget to release it, when you are finished.

> This gives me the exception listed below.
> I noticed that the page that triggered the action, has no more a
> jsessionid=ABCDXYZ in the URL. So, may be, I lost my Java session. But I
> have no idea how the SunShine context is propagated between
> different pages.
> Can someone comment on how the SunShine context is stored and can be
> accessed? And what is needed to access it 10 pages later in my (browser)
> session?
>
The contexts are stored in the session, so as long the user has the session,
the context is available. If your servlet engine uses cookies and your
browser accepts cookies, then the jsessionid in the URL will disappear.
If cookies aren't used, the jsessionid must be appended to each URI,
you can use the encodeURL transformer in Cocoon to do so.

HTH
Carsten

Carsten Ziegeler     Chief Architect     Open Source Group, S&N AG
------------------------------------------------------------------
             Cocoon Consulting, Training and Projects
------------------------------------------------------------------
mailto:cziegeler@s-und-n.de                  http://www.s-und-n.de
                    http://ziegeler.bei.t-online.de


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Accessing SunShine context from Java Action

Posted by Hugo Burm <hu...@xs4all.nl>.
Hello,

Thanks to Carsten Ziegeler, my SunShine autorization and context is working
fine now.
Now I want to access the SunShine context from my own Java handler (an
Action).

I looked into the SunShine sources and tried to call the most simpe call
(check whether a SunShine context exists)
Something like this:

import org.apache.cocoon.sunshine.*;
[...]
SunShine sSun  = new SunShine();
boolean bSun = sSun.existsContext("survey");
[...]

This gives me the exception listed below.
I noticed that the page that triggered the action, has no more a
jsessionid=ABCDXYZ in the URL. So, may be, I lost my Java session. But I
have no idea how the SunShine context is propagated between different pages.
Can someone comment on how the SunShine context is stored and can be
accessed? And what is needed to access it 10 pages later in my (browser)
session?


Hugo Burm
hugob@xs4all.nl

==============


Original exception : java.lang.NullPointerException
at org.apache.cocoon.sunshine.SunShine.getSession(SunShine.java:358)
at org.apache.cocoon.sunshine.SunShine.existsContext(SunShine.java:999)
at
nl.datagram.cocoon.acting.SurveyDBSelectAction.act(SurveyDBSelectAction.java
:89)
at
org.apache.cocoon.components.treeprocessor.sitemap.ActionSetNode.call(Action
SetNode.java:165)
[ long dump of stack truncated ]


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>