cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Stocker" <chris.stoc...@gmx.at>
Subject url rewriting in with cocoon-actions
Date Fri, 01 Nov 2002 08:53:16 GMT
hi all!

i wrote my problem to the cocoon-users help, but they couldn't
help me. so i try it here, maybe someone has an answere for
my problem. i think it's not so easy.

if i am completely wrong here with my question, SORRY!



i use cocoon 2.0.2, win2000 and weblogic 6.0sp2

i want to tell again, in a detailed from, my problem. maybe someone can
help me.


i wrote a web-app using a java action described in
http://comphy.fsu.edu/xml/docs/actions.html with additional
session-handling. with the use of cookies, everthing is fine - now i
want to do it with url-rewriting and i did it the following way.


my action looks as following (here a code snipped from the main-part)
--->

package com.isolab.or.action;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.acting.AbstractAction;
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.environment.Session;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Response;

import java.util.*;
import java.util.Map;
import java.util.HashMap;

public class ORMainAction extends AbstractAction {

  public Map act(Redirector redirector, SourceResolver resolver, Map
objectModel,
            String source, Parameters params) {


      Map sitemapParams = new HashMap();
      Request req = ObjectModelHelper.getRequest(objectModel);
      Session session = req.getSession();


	if (session.isNew()) {
	   session.setAttribute("atr1", "TestAttribute1");		

         sitemapParams.put("nextpage", "test1");
	}
	else {
         session.setAttribute("atr2", "TestAttribute2");

	   sitemapParams.put("nextpage", "test2");
	}    

      return sitemapParams;
  }
}


my sitemap looks as following -->
as described in 
http://xml.apache.org/cocoon/userdocs/transformers/encodeurl-transformer
.html

.
.
<map:transformer logger="sitemap.transformer.encodeURL" name="encodeURL"
src="org.apache.cocoon.transformation.EncodeURLTransformer"/>
.
.
<map:action name="ORAction" src="com.isolab.or.action.ORMainAction"/>
.
.
.
<map:match pattern="startOR">
   <map:act type="ORAction">
      <map:generate src="orneu/{nextpage}.xsp" type="serverpages"/>
      <map:transform src="orneu/xml2html.xsl" type="xslt"/>
	<map:transform type="encodeURL"/>
   </map:act>
   <map:serialize type="html"/>
 </map:match>



i turned off the use of cookies in my weblogic-property file
"weblogic.xml"


------->
if i call my page an the action is called the first time, everthing
works fine (a new session is created, ...). but the second time with the
same browser (when the session is still there), the session is creted
again). this doesn't happen when i enable cookies in my "welogic.xml"
propertiy file

"welogic.xml" -->

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
	<session-descriptor>
		<session-param>
			<param-name>CookiesEnabled</param-name>
			<param-value>True</param-value>
		</session-param>
		<session-param>
			<param-name>URLRewritingEnabled</param-name>
			<param-value>True</param-value>
		</session-param>
		<session-param>
			<param-name>SessionTrackingEnabled</param-name>
			<param-value>True</param-value>
		</session-param>
	</session-descriptor>
</weblogic-web-app>


i studied the EncodeURLTransformer, but it doesn't helped me (i don't
know how to 
in my action use this for url-rewriting)

i also read chapters in some books about url-rewriting, they always use
response.encodeURL("URL"); 

but how can i use this response in my action?
what do i have to modify?
how can i use the EncodeURLTransformer in my action? do i have to do
this? is the only part to change, to use url-rewriting to insert
<map:serialize type="html"/> in my sitemap?


are there some examples or has someone examples doing url-rewriting with
cocoon and actions.

i tried several tasks, but it always leeds to the error (every time a
new session is creted and the previous session information is lost)
described above. please help, if someone has an answere.

greetings, chris







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


Mime
View raw message