Sharing components between Cocoon and servlets

2003-01-23 Thread Jeremy Aston
Hi,

I am looking to get some more documentation together on integrating servlets
and Cocoon and would like to know if anyone has got any production
experience of sharing contexts and thus components.  I want to have a
servlet running in the same web app context as Cocoon and have access to the
same resources (e.g. db connection pool) as Cocoon.  I have considered a
couple fo ways of implementing thus such as creating a new set of objects
that reference the same component xconf or using a parent component manager.
I have also noted a couple of threads on the lists that talk about using
request actions to pass session data to servlets.  The only thing about this
is that it means the servlet is called via the sitemap and I am not
concerned about this happening.

If anyone has any views or experience on how they think this is best done
then let me know and in return for saving me some investigation time I will
add details to the docs.

Thanks very much

Jeremy

attachment: winmail.dat-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


Session-objects in Cocoon using servlets and jsp

2002-11-30 Thread Torsten Reiners


Hi,

we have a major problem and do not know if there is a simple solution.
Hope that
somebody has an idea. The scenario is as follows:

we realized a login as well as some other things using jsp and servlets.
The jsp are read by th jsp-reader

  map:match pattern=jsps/*
map:read type=jsp mime-type=text/html src=/jsps/{1}/
  /map:match

Furthermore, we have an session-object that is used by the jsps and cocoon
to communicate with each other. Using just jsp and cocoon it is working well,
i.e., the session object can be used from both places (coccoon,jsp with
same session id).


We need to use a servlet to control some processes (i.e., jsp) and,
therefore,have to run the servlet in the same context as the jsp or cocoon.
Currently, the servlet is having it's own session object with its own session id and, 
therefore,
the cocoon-process can not communicate with the servlet. Also, the jsps
get the session-object and its id from the servlet and we can not use the
seession-object anymore for the communication.

Is there any way of running the servlet in the same context as cocoon/jsp?
Do I have to declare the servlet in a special way in web.xml or
sitemap.xmap?

I am not sure if the scenario is understandable. Please let me know if you
need more information about the configuration (BTW, we use cocoon 2.0.3).

Thanks,

Torsten




-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Session-objects in Cocoon using servlets and jsp

2002-11-28 Thread Torsten Reiners
Hi,

we have a major problem and do not know if there is a simple solution.
Hope that
somebody has an idea. The scenario is as follows:

we realized a login as well as some other things using jsp and servlets.
The jsp are read by th jsp-reader

  map:match pattern=jsps/*
map:read type=jsp mime-type=text/html src=/jsps/{1}/
  /map:match

Furthermore, we have an session-object that is used by the jsps and cocoon
to communicate with each other. Using just jsp and cocoon it is working well,
i.e., the session object can be used from both places (coccoon,jsp with
same session id).


We need to use a servlet to control some processes (i.e., jsp) and,
therefore,have to run the servlet in the same context as the jsp or cocoon.
Currently, the servlet is having it's own session object with its own session id and, 
therefore,
the cocoon-process can not communicate with the servlet. Also, the jsps
get the session-object and its id from the servlet and we can not use the
seession-object anymore for the communication.

Is there any way of running the servlet in the same context as cocoon/jsp?
Do I have to declare the servlet in a special way in web.xml or
sitemap.xmap?

I am not sure if the scenario is understandable. Please let me know if you
need more information about the configuration (BTW, we use cocoon 2.0.3).

Thanks,

Torsten



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Cocoon and Servlets

2002-10-27 Thread CLAIS, Rene
Title: Cocoon and Servlets







I have seen this subject (Cocoon with Servlets) in a huge number of archive

Anyway no one can explain me how my problem can be solved (I do not find the right one !!)


The problem is : how can I retrieve java object in a cocoon session ?


My example:


I have a cocoon XLM / XSL showing a HTML page (That works !)

This HTML contains a form which call my Servlet1 (That works !)


form action="Servlet1" method=post

Your name: input type=text name=thename/

/form


This Servlet1 make a senRedirect to ../Cocoon/servlet2 (Good that works)

 the site map contains:

 map:pipeline 

  map:match pattern=servlet2

   map:generate src="<A" HREF="http://localhost:8080/Cocoontest/servlet/cocontest.Servlet2">http://localhost:8080/Cocoontest/servlet/cocontest.Servlet2/

   map:transform src="appl/servlet2.xsl/

   map:serialize/

  /map:match

 /map:pipeline 


The cocoontest.Servlet2 write a xml layout in the generator

this one is transformed by the appl/servlet2.xsl

and serialized in a HTML page.


All this stuff works well.  


In my Servlet1 I put some attributes in the session:


HttpSession session = request.getSession();

session.setAttribute=(test,cocoon is great !!);


In my Servlet2 I get this attribute:


String value = (String) session.getAttribute(test);


This instruction return a null in the String value.


Does that means that the session of the first called servlet and the session of the second calling servlet are not the same ?

If no:  what is wrong ?

if yes: how can I put objects in session that can be retrieved by servlets writing in the Cocoon generator ?


Thanks a lot for advice and help


René Clais





Re: Cocoon and Servlets

2002-10-27 Thread SAXESS - Hussayn Dabbous
I may be wrong, but i assume, the problem comes from
the redirection specs in your sitemap:

When you call the source 

   http://localhost:8080/Cocoontest/servlet/cocontest.Servlet2

cocoon probably does this by making a http:client call to that resource. 
This is definitely done in a separate session. What exactly do you
want to achieve? Couldn't this be done cheeper by passing parameters 
in the redirect of your Servlet1 to Servlet2 ?

regards, hussayn


CLAIS, Rene wrote:

I have seen this subject (Cocoon with Servlets)  in a huge number of 
archive
Anyway no one can explain me how my problem can be solved (I do not find 
the right one !!)

The problem is : how can I retrieve java object in a cocoon session ?

My example:

I have a cocoon XLM / XSL showing a HTML page  (That works !)
This HTML contains a form which call my Servlet1  (That works !)

form action=Servlet1 method=post
Your name: input type=text name=thename/
/form

This Servlet1 make a senRedirect to  ../Cocoon/servlet2  (Good that works)
the site map contains:
map:pipeline 
map:match pattern=servlet2
map:generate 
src=http://localhost:8080/Cocoontest/servlet/cocontest.Servlet2/
map:transform src=appl/servlet2.xsl/
map:serialize/
/map:match
/map:pipeline

The cocoontest.Servlet2 write a xml layout in the generator
this one is transformed by the appl/servlet2.xsl
and serialized in a HTML page.

All this stuff works well. 

In my Servlet1 I put  some attributes in the session:

HttpSession session = request.getSession();
session.setAttribute=(test,cocoon is great !!);

In my Servlet2 I get this attribute:

String value = (String) session.getAttribute(test);

This instruction return a null in the String value.

Does that means that the session of the first called servlet and the 
session of the second calling servlet are not the same ?

If no:     what is wrong ?
if yes:  how can I put objects in session that can be retrieved  by 
servlets writing in the Cocoon generator ?

Thanks a lot for advice and help

René Clais



--
Dr. Hussayn Dabbous
SAXESS Software Design GmbH
Neuenhöfer Allee 125
50935 Köln
Telefon: +49-221-56011-0
Fax: +49-221-56011-20
E-Mail:  [EMAIL PROTECTED]


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Cocoon and servlets (MVC)

2002-01-20 Thread Peter Schwenke


Hi,

I currently have part of a system working under cocoon.  I have some
servlets which are called by those pages, working in a different
Tomcat context. I would like to bring the two together - mainly for the
reason that they use the same session id from tomcat.

Since cocoon is a webapp on it's own I can forsee some difficulties
(classloaders etc) in trying to get them to run in the same
context. I'd thought of trying do it in the ROOT context.

I was wondering if anybody has managed to get servlets working under
Cocoon as well as transformed XML pages, or has any advice.  Or am I
wasting time and could just put the servlets into cocoon/WEB-INF/web.xml.

Thanks
...Peter




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

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