You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaNet <an...@jibeya.com> on 2004/10/27 22:03:03 UTC

Urgent! cocoon.createSession() not working in 2.1.5.1

Hi,
I am running cocoon 2.1.5.1 in JBoss 4.0 like so:

/server/default/deploy/jbossweb-tomcat50.sar/cocoon.war

i have a website which uses simple MVC using flowscript. I originally 
developed the system under tomcat alone using cocoon 2.1.4 which worked 
fine. I copied the cocoon folder and placed it in the above mentioned 
directory in JBoss. Now flowscript does not work. I have a few global 
variables which I make persistent by initiating cocoon.createSession(), 
but when I move from page to page and try and grab the values from 
those global variables they all have a null value. What is going on 
here? Is anybody else experiencing this under 2.1.5.1 using JBoss 4.0? 
Any input on this issue is urgently required.

many thanks


Andrew


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


Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by beyaNet <an...@jibeya.com>.
Upayavira,
thanks for your reply. I understand what you have written thus far. In 
regards
  to your statement:

'The solution is to have Apache and Cocoon/servlet container use the 
same directory nesting, e.g:
>
> http://www.yoursite.com:80/hello.html --> 
> http://www.yoursite.com:8080/hello.html


do I keep my http.conf file as it is:

RewriteRule (.*)\.xml$ cocoon/mysite/$1.xml [P]
RewriteRule (.*)\.xsl$ cocoon/mysite/$1.xsl [P]
RewriteRule (.*)\.kont$ cocoon/mysite/$1.kont [P]
RewriteRule (.*)\.jxt$ cocoon/mysite/$1.jxt [P]
RewriteRule (.*)\.xsp$ cocoon/mysite/$1.xsp [P]
RewriteRule (.*)\.css$ cocoon/mysite/$1.css [P]
RewriteRule (.*)\.js$ cocoon/mysite/$1.js [P]
RewriteRule (.*)\.mp3$ cocoon/mysite/$1.mp3 [P]
RewriteRule (.*)\.m3u$ cocoon/mysite/$1.m3u [P]
RewriteRule (.*)\.jpg$ cocoon/mysite/$1.jpg [P]

taking into consideration that my workers2.properties file is:

[uri:/cocoon/mysite/*]
group=lb

and make a port change in cocoon? If so where do I make the change? 
Should the rewriterule not take place before the mod_rewrite?

many thanks for your help

Andrew
On 2 Nov 2004, at 06:43, Upayavira wrote:

> beyaNet wrote:
>
>> Upayavira,
>> thanks for your reply. I'm not sure I quitefollow you as this whole 
>> Apache RewriteRule business is new to me. Could you possible give me 
>> an example of what you mean?
>
> Sorry for the delay. I missed your message.
>
> Take this:
>
> user goes to www.yoursite.com:80/hello.html
> this redirects to www.yoursite.com:8080/cocoon/hello.html
>
> When generating this page, Cocoon creates a session. When the servlet 
> container creates a session, it will create it relative to the server 
> and the _path_, i.e. www.yoursite.com and /cocoon. This is passed back 
> to Apache, which returns a page to them with the url 
> www.yoursite.com:80/hello.html, and a cookie for the path /cocoon.
>
> When they then click on the link to www.yoursite.com:80/another.html, 
> the browser says to itself, "Do I have any cookies for this path?", to 
> which the answer is 'no', as the /cocoon cookie isn't relevant. But it 
> should have been. It is your session cookie. Hence, when generating 
> the another.html page, Cocoon will create a new session for it.
>
> The solution is to have Apache and Cocoon/servlet container use the 
> same directory nesting, e.g:
>
> http://www.yoursite.com:80/hello.html --> 
> http://www.yoursite.com:8080/hello.html
>
> That's it really.
>
> Now say you want to have:
>
> http://www.myfirstsite.com:80/hello.html -> 
> http://www.myfirstsite.com:8080/first/hello.html
> http://www.mysecondsite.com:80/hello.html -> 
> http://www.mysecondsite.com:8080/second/hello.html
>
> You should switch that to:
>
> http://www.myfirstsite.com:80/hello.html -> 
> http://www.myfirstsite.com:8080/hello.html
> http://www.mysecondsite.com:80/hello.html -> 
> http://www.mysecondsite.com:8080/hello.html
>
> and have either your servlet container mount different webapps based 
> upon the hostname, or have Cocoon use the HostMatcher to mount 
> different sitemaps based upon hostname.
>
> Make sense now?
>
> Regards, Upayavira
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by beyaNet <an...@jibeya.com>.
Upayavira,
on my standalone version of tomcat I set the docBase="cocoon". Apache2 
was connected to tomcat via mod_jk2. So tomcat now becomes:

http://www.mysite.com:8080/cocoon

Setting my http.conf file with the following settings:

RewriteEngine on

RewriteRule (.*)\.xml$ beyarecords/$1.xml [P]
RewriteRule (.*)\.xsl$ beyarecords/$1.xsl [P]
RewriteRule (.*)\.kont$ beyarecords/$1.kont [P]
RewriteRule (.*)\.jx$ beyarecords/$1.jx [P]
RewriteRule (.*)\.xsp$ beyarecords/$1.xsp [P]
RewriteRule (.*)\.css$ beyarecords/$1.css [P]
RewriteRule (.*)\.js$ beyarecords/$1.js [P]
RewriteRule (.*)\.mp3$ beyarecords/$1.mp3 [P]
RewriteRule (.*)\.m3u$ beyarecords/$1.m3u [P]
RewriteRule (.*)\.jpg$ beyarecords/$1.jpg [P]

Then enabled me to do the following:

http://www.mysite.com/filename.xml

and everything worked fine. Filenames that were not defined with a 
rewrite rule were searched for on Apache. With my current Jboss setup 
this is not the case. With the Jboss out of the box the docBase is 
ROOT.war for which if you enter:

http://www.mysite.com:8080/index.html

the actual folder structure to access index.html is:

/server/default/deploy/jbossweb-tomcat50.sar/root.war/index.html

So if I change the docBase to point away from root.war to cocoon.war, 
will this not then allow me to do what i need to do? how do I change 
the docbase of jboss-tomcat50.sar from root.war to cocoon.war?

many thanks


Andrew


On 2 Nov 2004, at 06:43, Upayavira wrote:

> beyaNet wrote:
>
>> Upayavira,
>> thanks for your reply. I'm not sure I quitefollow you as this whole 
>> Apache RewriteRule business is new to me. Could you possible give me 
>> an example of what you mean?
>
> Sorry for the delay. I missed your message.
>
> Take this:
>
> user goes to www.yoursite.com:80/hello.html
> this redirects to www.yoursite.com:8080/cocoon/hello.html
>
> When generating this page, Cocoon creates a session. When the servlet 
> container creates a session, it will create it relative to the server 
> and the _path_, i.e. www.yoursite.com and /cocoon. This is passed back 
> to Apache, which returns a page to them with the url 
> www.yoursite.com:80/hello.html, and a cookie for the path /cocoon.
>
> When they then click on the link to www.yoursite.com:80/another.html, 
> the browser says to itself, "Do I have any cookies for this path?", to 
> which the answer is 'no', as the /cocoon cookie isn't relevant. But it 
> should have been. It is your session cookie. Hence, when generating 
> the another.html page, Cocoon will create a new session for it.
>
> The solution is to have Apache and Cocoon/servlet container use the 
> same directory nesting, e.g:
>
> http://www.yoursite.com:80/hello.html --> 
> http://www.yoursite.com:8080/hello.html
>
> That's it really.
>
> Now say you want to have:
>
> http://www.myfirstsite.com:80/hello.html -> 
> http://www.myfirstsite.com:8080/first/hello.html
> http://www.mysecondsite.com:80/hello.html -> 
> http://www.mysecondsite.com:8080/second/hello.html
>
> You should switch that to:
>
> http://www.myfirstsite.com:80/hello.html -> 
> http://www.myfirstsite.com:8080/hello.html
> http://www.mysecondsite.com:80/hello.html -> 
> http://www.mysecondsite.com:8080/hello.html
>
> and have either your servlet container mount different webapps based 
> upon the hostname, or have Cocoon use the HostMatcher to mount 
> different sitemaps based upon hostname.
>
> Make sense now?
>
> Regards, Upayavira
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by Upayavira <uv...@upaya.co.uk>.
beyaNet wrote:

> Upayavira,
> thanks for your reply. I'm not sure I quitefollow you as this whole 
> Apache RewriteRule business is new to me. Could you possible give me 
> an example of what you mean?

Sorry for the delay. I missed your message.

Take this:

user goes to www.yoursite.com:80/hello.html
this redirects to www.yoursite.com:8080/cocoon/hello.html

When generating this page, Cocoon creates a session. When the servlet 
container creates a session, it will create it relative to the server 
and the _path_, i.e. www.yoursite.com and /cocoon. This is passed back 
to Apache, which returns a page to them with the url 
www.yoursite.com:80/hello.html, and a cookie for the path /cocoon.

When they then click on the link to www.yoursite.com:80/another.html, 
the browser says to itself, "Do I have any cookies for this path?", to 
which the answer is 'no', as the /cocoon cookie isn't relevant. But it 
should have been. It is your session cookie. Hence, when generating the 
another.html page, Cocoon will create a new session for it.

The solution is to have Apache and Cocoon/servlet container use the same 
directory nesting, e.g:

http://www.yoursite.com:80/hello.html --> 
http://www.yoursite.com:8080/hello.html

That's it really.

Now say you want to have:

http://www.myfirstsite.com:80/hello.html -> 
http://www.myfirstsite.com:8080/first/hello.html
http://www.mysecondsite.com:80/hello.html -> 
http://www.mysecondsite.com:8080/second/hello.html

You should switch that to:

http://www.myfirstsite.com:80/hello.html -> 
http://www.myfirstsite.com:8080/hello.html
http://www.mysecondsite.com:80/hello.html -> 
http://www.mysecondsite.com:8080/hello.html

and have either your servlet container mount different webapps based 
upon the hostname, or have Cocoon use the HostMatcher to mount different 
sitemaps based upon hostname.

Make sense now?

Regards, Upayavira



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


Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by beyaNet <an...@jibeya.com>.
Upayavira,
thanks for your reply. I'm not sure I quitefollow you as this whole 
Apache RewriteRule business is new to me. Could you possible give me an 
example of what you mean?

many thanks for your help

Andrew
On 29 Oct 2004, at 11:41, Upayavira wrote:

> Upayavira


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


Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by Upayavira <uv...@upaya.co.uk>.
Tee hee. You got caught.

The user goes to www.mysite.com.
Apache forwards it to www.mysite.com:8080/cocoon.
Cocoon creates a session cookie for domain www.mysite.com:8080, with 
path /cocoon
Apache returns this page to the user, with this session cookie
User requests www.mysite.com/anotherpage.html.
Browser looks to see if it has any cookies for www.mysite.com, directory 
/. It doesn't. It has one for /cocoon, but not one for /, so it doesn't 
send the cookie to the server.

Kerbang.

What you need to do is make sure your Apache URLs use the same 
directories as your Cocoon ones.

For virtual hosting, I have Jetty match on virtual host names, so 
webapps are mounted based upon the domain names, rather than based upon 
folders.

Hope that makes sense.

Upayavira


beyaNet wrote:

> Hi,
> it seems the cause of my problem is the RewriteRule lines I have 
> specified in my Apache http.conf file. In my workers2.properties file 
> I have the following line:
>
> [uri:/cocoon/mysite/*] (note: cocoon/mysite is situated inside JBoss 
> 4.0.0 as /server/default/deploy/jbossweb-tomcat50.sar/cocoon.war/mysite)
> group=lb
>
> which enables me to access my website via :80 by saying:
>
> http://www.mysite.com/cocoon/mysite/login.xml
>
> Doing this works fine and you can browse from one page to another and 
> all sessions are maintained. The problem starts when I try and do:
>
> http://www.mysite.com/login.xml
>
> which I have catered for in my http.conf file by defining a number of 
> RewriteRule lines:
>
> RewriteEngine on
>
> RewriteRule (.*)\.xml$ cocoon/mysite/$1.xml [P]
> RewriteRule (.*)\.xsl$ cocoon/mysite/$1.xsl [P]
> RewriteRule (.*)\.kont$ cocoon/mysite/$1.kont [P]
> RewriteRule (.*)\.jxt$ cocoon/mysite/$1.jxt [P]
> RewriteRule (.*)\.xsp$ cocoon/mysite/$1.xsp [P]
> RewriteRule (.*)\.css$ cocoon/mysite/$1.css [P]
> RewriteRule (.*)\.js$ cocoon/mysite/$1.js [P]
> RewriteRule (.*)\.mp3$ cocoon/mysite/$1.mp3 [P]
> RewriteRule (.*)\.m3u$ cocoon/mysite/$1.m3u [P]
> RewriteRule (.*)\.jpg$ cocoon/mysite/$1.jpg [P]
>
> When I type in http://www.mysite.com/login.xml the page loads fine, 
> and in the process creates a session to maintain flow global 
> variables. When you then try and select any other page which requires 
> you to have been logged in first, it seems the page has lost 
> scope/context/domain! and acts a if you have come to the site for the 
> first time and so redirects you straight back to the login.xml page. 
> But as I have said before typing 
> http://www.mysite.com/cocoon/mysite/login.xml works fine and I can 
> navigate from page to page no problem.
>
> Does anybody have a solution for this?
>
> many thanks in advance
>
> Andrew
>
>
> On 28 Oct 2004, at 16:19, beyaNet wrote:
>
>     Does anybody have any experiences/solutions on this issue?
>
>     regards
>
>
>     Andrew
>     On 27 Oct 2004, at 21:03, beyaNet wrote:
>
>         Hi,
>         I am running cocoon 2.1.5.1 in JBoss 4.0 like so:
>
>         /server/default/deploy/jbossweb-tomcat50.sar/cocoon.war
>
>         i have a website which uses simple MVC using flowscript. I
>         originally developed the system under tomcat alone using
>         cocoon 2.1.4 which worked fine. I copied the cocoon folder and
>         placed it in the above mentioned directory in JBoss. Now
>         flowscript does not work. I have a few global variables which
>         I make persistent by initiating cocoon.createSession(), but
>         when I move from page to page and try and grab the values from
>         those global variables they all have a null value. What is
>         going on here? Is anybody else experiencing this under 2.1.5.1
>         using JBoss 4.0? Any input on this issue is urgently required.
>
>         many thanks
>
>
>         Andrew
>
>
>         ---------------------------------------------------------------------
>
>         To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>         For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>     <beya-email.gif>
>     * +The home of urban music
>     + http://www.beyarecords.com
>     *
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
> ------------------------------------------------------------------------
>
>
>
> * +The home of urban music
> + http://www.beyarecords.com
> *
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by beyaNet <an...@jibeya.com>.
Hi,
it seems the cause of my problem is the RewriteRule lines I have 
specified in my Apache http.conf file. In my workers2.properties file I 
have the following line:

[uri:/cocoon/mysite/*] (note: cocoon/mysite is situated inside JBoss 
4.0.0 as 
/server/default/deploy/jbossweb-tomcat50.sar/cocoon.war/mysite)
group=lb

which enables me to access my website via :80 by saying:

http://www.mysite.com/cocoon/mysite/login.xml

Doing this works fine and you can browse from one page to another and 
all sessions are maintained. The problem starts when I try and do:

http://www.mysite.com/login.xml

which I have catered for in my http.conf file by defining a number of 
RewriteRule lines:

RewriteEngine on

RewriteRule (.*)\.xml$ cocoon/mysite/$1.xml [P]
RewriteRule (.*)\.xsl$ cocoon/mysite/$1.xsl [P]
RewriteRule (.*)\.kont$ cocoon/mysite/$1.kont [P]
RewriteRule (.*)\.jxt$ cocoon/mysite/$1.jxt [P]
RewriteRule (.*)\.xsp$ cocoon/mysite/$1.xsp [P]
RewriteRule (.*)\.css$ cocoon/mysite/$1.css [P]
RewriteRule (.*)\.js$ cocoon/mysite/$1.js [P]
RewriteRule (.*)\.mp3$ cocoon/mysite/$1.mp3 [P]
RewriteRule (.*)\.m3u$ cocoon/mysite/$1.m3u [P]
RewriteRule (.*)\.jpg$ cocoon/mysite/$1.jpg [P]

When I type in http://www.mysite.com/login.xml the page loads fine, and 
in the process creates a session to maintain flow global variables. 
When you then try and select any other page which requires you to have 
been logged in first, it seems the page has lost scope/context/domain! 
and acts a if you have come to the site for the first time and so 
redirects you straight back to the login.xml page. But as I have said 
before typing http://www.mysite.com/cocoon/mysite/login.xml works fine 
and I can navigate from page to page no problem.

Does anybody have a solution for this?

many thanks in advance

Andrew


On 28 Oct 2004, at 16:19, beyaNet wrote:

> Does anybody have any experiences/solutions on this issue?
>
> regards
>
>
> Andrew
> On 27 Oct 2004, at 21:03, beyaNet wrote:
>
>> Hi,
>> I am running cocoon 2.1.5.1 in JBoss 4.0 like so:
>>
>> /server/default/deploy/jbossweb-tomcat50.sar/cocoon.war
>>
>> i have a website which uses simple MVC using flowscript. I originally 
>> developed the system under tomcat alone using cocoon 2.1.4 which 
>> worked fine. I copied the cocoon folder and placed it in the above 
>> mentioned directory in JBoss. Now flowscript does not work. I have a 
>> few global variables which I make persistent by initiating 
>> cocoon.createSession(), but when I move from page to page and try and 
>> grab the values from those global variables they all have a null 
>> value. What is going on here? Is anybody else experiencing this under 
>> 2.1.5.1 using JBoss 4.0? Any input on this issue is urgently 
>> required.
>>
>> many thanks
>>
>>
>> Andrew
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
> <beya-email.gif>
>  +The home of urban music
>  + http://www.beyarecords.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

Re: Urgent! cocoon.createSession() not working in 2.1.5.1

Posted by beyaNet <an...@jibeya.com>.
Does anybody have any experiences/solutions on this issue?

regards


Andrew
On 27 Oct 2004, at 21:03, beyaNet wrote:

> Hi,
> I am running cocoon 2.1.5.1 in JBoss 4.0 like so:
>
> /server/default/deploy/jbossweb-tomcat50.sar/cocoon.war
>
> i have a website which uses simple MVC using flowscript. I originally 
> developed the system under tomcat alone using cocoon 2.1.4 which 
> worked fine. I copied the cocoon folder and placed it in the above 
> mentioned directory in JBoss. Now flowscript does not work. I have a 
> few global variables which I make persistent by initiating 
> cocoon.createSession(), but when I move from page to page and try and 
> grab the values from those global variables they all have a null 
> value. What is going on here? Is anybody else experiencing this under 
> 2.1.5.1 using JBoss 4.0? Any input on this issue is urgently required.
>
> many thanks
>
>
> Andrew
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>