Hello again! i have tried to setup the pipeline another way and lokked at the compiled sitemap java code. it seems that the java code generated is far away from being complete...
are the sessionstate matcher code for the sitemap broken in cocoon 2.0.1? if so, can i change only the sessionstate code parts to avoid migrating the whole application to a newer cocoon version? thx, Chris btw: sitemap and compiled sitemap attached for interest... bbtw: compiled sitemap not fully attached because listadmin tells me the posting is too big... ;-( -snip //line numbers not supported with xalan// method for handling "*" private final boolean matchN101AC(SitemapRedirector redirector, Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline, boolean internalRequest, List listOfMaps) throws ConnectionResetException, ResourceNotFoundException, Exception { Map map; Parameters param; Map objectModel = environment.getObjectModel(); String cocoon_view = environment.getView(); String cocoon_action = environment.getAction(); final boolean debug_enabled = getLogger().isDebugEnabled(); if ((map = matches("wildcard", matcher_N101AC_expr, "*", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern *"); listOfMaps.add (map); this.dumpParameters(listOfMaps); param = new Parameters (); param.setParameter ("attribute-name", "user"); // handling "*" <*> if ((map = matches("sessionstate", matcher_N101AF_expr, "*", param, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched sessionstate pattern *"); listOfMaps.add (map); this.dumpParameters(listOfMaps); // handling "**/*.css" if ((map = matches("wildcard", matcher_N101B7_expr, "**/*.css", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern **/*.css"); listOfMaps.add (map); this.dumpParameters(listOfMaps); getLogger().debug("Component reader:resource(Parameters.EMPTY_PARAMETERS)"); if (debug_enabled) getLogger().debug("Source= " + substitute(listOfMaps, "css/{2}.css")); getLogger().debug("Mime-type= text/css"); pipeline.setReader ("resource", substitute(listOfMaps, "css/{2}.css"), Parameters.EMPTY_PARAMETERS, "text/css"); if (!internalRequest) { return pipeline.process(environment); } if (true) return true; listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } // handling "images/**.*" if ((map = matches("wildcard", matcher_N101BF_expr, "images/**.*", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern images/**.*"); listOfMaps.add (map); this.dumpParameters(listOfMaps); getLogger().debug("Component reader:resource(Parameters.EMPTY_PARAMETERS)"); if (debug_enabled) getLogger().debug("Source= " + substitute(listOfMaps, "images/{1}.{2}")); getLogger().debug("Mime-type= image/{2}"); pipeline.setReader ("resource", substitute(listOfMaps, "images/{1}.{2}"), Parameters.EMPTY_PARAMETERS, "image/{2}"); if (!internalRequest) { return pipeline.process(environment); } if (true) return true; listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } // handling "**/*.js" if ((map = matches("wildcard", matcher_N101C7_expr, "**/*.js", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern **/*.js"); listOfMaps.add (map); this.dumpParameters(listOfMaps); getLogger().debug("Component reader:resource(Parameters.EMPTY_PARAMETERS)"); if (debug_enabled) getLogger().debug("Source= " + substitute(listOfMaps, "jscript/{2}.js")); getLogger().debug("Mime-type= text/javascript"); pipeline.setReader ("resource", substitute(listOfMaps, "jscript/{2}.js"), Parameters.EMPTY_PARAMETERS, "text/javascript"); if (!internalRequest) { return pipeline.process(environment); } if (true) return true; listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } // handling "applets/**" if ((map = matches("wildcard", matcher_N101CF_expr, "applets/**", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern applets/**"); listOfMaps.add (map); this.dumpParameters(listOfMaps); getLogger().debug("Component reader:resource(Parameters.EMPTY_PARAMETERS)"); if (debug_enabled) getLogger().debug("Source= " + substitute(listOfMaps, "applets/{1}")); getLogger().debug("Mime-type= application/octet-stream"); pipeline.setReader ("resource", substitute(listOfMaps, "applets/{1}"), Parameters.EMPTY_PARAMETERS, "application/octet-stream"); if (!internalRequest) { return pipeline.process(environment); } if (true) return true; listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } // handling "*/**" if ((map = matches("wildcard", matcher_N101D7_expr, "*/**", Parameters.EMPTY_PARAMETERS, objectModel)) != null) { if (debug_enabled) getLogger().debug("Matched wildcard pattern */**"); listOfMaps.add (map); this.dumpParameters(listOfMaps); if (internalRequest) return sitemapManager.invoke (this.manager, environment, substitute(listOfMaps, "{1}"), substitute(listOfMaps, "{1}/"), true, true, pipeline, eventPipeline); else if (true) return sitemapManager.invoke (this.manager, environment, substitute(listOfMaps, "{1}"), substitute(listOfMaps, "{1}/"), true, true); listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } listOfMaps.remove (listOfMaps.size() - 1); this.dumpParameters(listOfMaps); } -snap the generated code from sitemap_.java ends here. and on the line marked with <*> i got a language exception at the character i from if and some other language exceptions after this line till the last language exception at the apprupt end of the java file... On Wed, Nov 06, 2002 at 02:52:15PM +0100, Christian Joelly wrote: > > i have some troubles using the sessionstate matcher in a pipeline. > I want to check for the existance of a session attribute, and when it > doesn't exist we should be redirected to a login page: > > But i got lots of errors when i call want to use this pipeline... > > <map:pipeline> > > <map:match pattern="*" type="sessionstate"> > <map:parameter name="attribute-name" value="user"/> > <map:redirect uri="login/login.xml"/> > </map:match> > > <map:match pattern="**/*.css"> > <map:read src="css/{2}.css" mime-type="text/css"/> > </map:match> > > <map:match pattern="images/**.*"> > <map:read src="images/{1}.{2}" mime-type="image/{2}"/> > </map:match> > > <map:match pattern="**/*.js"> > <map:read src="jscript/{2}.js" mime-type="text/javascript"/> > </map:match> > > <map:match pattern="applets/**"> > <map:read src="applets/{1}" mime-type="application/octet-stream"/> > </map:match> > > <map:match pattern="*/**"> > <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/> > </map:match> > > </map:pipeline> -- KNAPP Logistics Automation http://www.knapp.com Ing. Christian Jölly Tel/FAX: (++43) 316 / 495 1926 / 495 394 Günter-Knapp-Straße 5-7 A-8075 Hart bei Graz -- Support your government, give Echelon/Carnivore something to parse -- AMTAS ATMD ATSC Abdullah Allah communist CIA DD2-N DISA DoD GRU Gregori Irak Iran KGB Kurdish LSD NATO NSTD Natasha ORD RTEM Russia STRAP Saddam Hussein TSP Yugoslavia attack bank bomb classfield cocain compromise defense democracy destroy destruct detonator directorate elections enforce extasy force foreign embassy government grass hashish heroin illegal information international military systems missile million dollars nuclear policital pot power presidental project restricted data revolution rule the world sensitive smuggle spy steal system takeover terrorist top-secret warmod warrior-T weapon weed ------------------------------------------------------------------------
<?xml version="1.0"?> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <!-- This is the 'heart' of Cocoon. The sitemap maps URI space to resources. It consists basicly of two parts: components and pipelines. Pipelines are made out of components. There is such a vast number of components available that it would be impossible to describe them here, please refer to the accompanying documentation. For specific components, have a look also at the javadocs for them. Most pipelines are present to demonstrate some feature or technique, often they are explained in more detail in the accompanying documentation. There are some other, less important parts that deal with resources, views and action sets. For now, ignore them. --> <!-- =========================== Components ================================ --> <map:components> <!-- All pipelines consist at least of two components: a generator, that produces the content and a serialiser, that delivers the content to the client. More precisely: a generator generates SAX events and a serializer consumes these events and produces a character stream. Some things to note here: each generator has a unique name, this name is mapped to a java class, one name is declared as default generator. In addition each generator may have additional configurations as child elements. Additional attributes are targeted at the component manager. The optional "label" attribute is relevant for the view concept below. It is possible to have the same java class declared as different generators by using different names. No configuration options are shared between these instances, however. All components follow this schema. --> <map:generators default="file"> <map:generator name="file" src="org.apache.cocoon.generation.FileGenerator" label="content" pool-max="32" pool-min="16" pool-grow="4"/> <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" label="content"/> <map:generator name="imagedirectory" src="org.apache.cocoon.generation.ImageDirectoryGenerator" label="content"/> <map:generator name="serverpages" src="org.apache.cocoon.generation.ServerPagesGenerator" label="content"/> <map:generator name="request" src="org.apache.cocoon.generation.RequestGenerator"/> <map:generator name="status" src="org.apache.cocoon.generation.StatusGenerator"/> <map:generator name="extractor" src="org.apache.cocoon.generation.FragmentExtractorGenerator"/> <map:generator name="script" src="org.apache.cocoon.generation.ScriptGenerator"/> <map:generator name="velocity" src="org.apache.cocoon.generation.VelocityGenerator"/> <map:generator name="jsp" src="org.apache.cocoon.generation.JspGenerator"/> <map:generator name="stream" src="org.apache.cocoon.generation.StreamGenerator"/> <map:generator name="html" src="org.apache.cocoon.generation.HTMLGenerator" label="content"/> </map:generators> <!-- Transformers can be placed inside the pipeline between the generator and the serializer. You may have as many transformers as you like. Transformers consume SAX events and emmit SAX events. The "xslt" transformer is an example of a component with additional configuration. --> <map:transformers default="xslt"> <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer" pool-max="32" pool-min="16" pool-grow="4"> <use-request-parameters>false</use-request-parameters> <use-browser-capabilities-db>false</use-browser-capabilities-db> </map:transformer> <map:transformer name="log" src="org.apache.cocoon.transformation.LogTransformer"/> <map:transformer name="sql" src="org.apache.cocoon.transformation.SQLTransformer"/> <map:transformer name="extractor" src="org.apache.cocoon.transformation.FragmentExtractorTransformer"/> <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer"> <catalogue-name>messages</catalogue-name> <catalogue-location>translations</catalogue-location> </map:transformer> <map:transformer name="xinclude" src="org.apache.cocoon.transformation.XIncludeTransformer"/> <map:transformer name="cinclude" src="org.apache.cocoon.transformation.CIncludeTransformer"/> <map:transformer name="filter" src="org.apache.cocoon.transformation.FilterTransformer"/> <map:transformer name="writeDOMsession" src="org.apache.cocoon.transformation.WriteDOMSessionTransformer"/> <map:transformer name="readDOMsession" src="org.apache.cocoon.transformation.ReadDOMSessionTransformer"/> <map:transformer name="xt" src="org.apache.cocoon.transformation.XTTransformer"/> </map:transformers> <!-- Readers are an exception to the above rule that a pipline need to have exactly one generator and exactly one serializer. Readers circumvent the XML oriented SAX pipeline model, think of a reader being a generator and a serializer at once thus a pipeline may not contain any generator, transformer or serializer in addition to a reader. They are useful for delivering binary content like images. --> <map:readers default="resource"> <map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader"/> </map:readers> <!-- Serializers consume SAX events and produce a character stream. Every pipeline needs to be terminated by a serializer. --> <map:serializers default="html"> <map:serializer name="links" src="org.apache.cocoon.serialization.LinkSerializer"/> <map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer" pool-max="32" pool-min="16" pool-grow="4"/> <map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer"> <!-- Troubles mit dem TreeView im Galeon/Mozilla <doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public> <doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system> --> <doctype-public>-//W3C//DTD HTML 4.0 Transitional//EN</doctype-public> <doctype-system>http://www.w3.org/TR/REC-html40/loose.dtd</doctype-system> <encoding>ISO-8859-15</encoding> <omit-xml-declaration>yes</omit-xml-declaration> </map:serializer> <map:serializer name="vrml" mime-type="model/vrml" src="org.apache.cocoon.serialization.TextSerializer"/> <map:serializer name="wap" mime-type="text/vnd.wap.wml" src="org.apache.cocoon.serialization.XMLSerializer"> <doctype-public>-//WAPFORUM//DTD WML 1.1//EN</doctype-public> <doctype-system>http://www.wapforum.org/DTD/wml_1.1.xml</doctype-system> <encoding>ASCII</encoding> <omit-xml-declaration>yes</omit-xml-declaration> </map:serializer> <map:serializer name="svgxml" mime-type="image/svg-xml" src="org.apache.cocoon.serialization.XMLSerializer"> <doctype-public>-//W3C//DTD SVG 20000303 Stylable//EN</doctype-public> <doctype-system>http://www.w3.org/TR/2000/03/WD-SVG-20000303/</doctype-system> </map:serializer> <map:serializer name="svg2jpeg" src="org.apache.cocoon.serialization.SVGSerializer" mime-type="image/jpeg"/> <map:serializer name="svg2png" src="org.apache.cocoon.serialization.SVGSerializer" mime-type="image/png"/> <map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf"/> <map:serializer name="fo2ps" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/postscript"/> <map:serializer name="fo2pcl" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/vnd.hp-PCL"/> </map:serializers> <!-- Matchers are executed during pipeline setup. They decide if a pipeline fragment is used within a pipeline. Usually, the decision is based on a match on the requested URI but matchers exist, that match different things as well. Most often the fragment contained in a matcher has a generator as well as a serializer. This is not a necessity, matchers can be nested while chaining does not work. Related concepts are selectors and actions. Since this is important, let me repeat it: Matchers are executed during pipeline setup. --> <map:matchers default="wildcard"> <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/> <map:matcher name="regexp" src="org.apache.cocoon.matching.RegexpURIMatcher"/> <map:matcher name="request" src="org.apache.cocoon.matching.RequestParamMatcher"/> <map:matcher name="sessionstate" src="org.apache.cocoon.matching.WildcardSessionAttributeMatcher"> <attribute-name>org.apache.cocoon.SessionState</attribute-name> <attribute-name>user</attribute-name> </map:matcher> <map:matcher name="next-page" src="org.apache.cocoon.matching.WildcardParameterValueMatcher"> <parameter-name>next-state</parameter-name> </map:matcher> <map:matcher name="referer-match" src="org.apache.cocoon.matching.WildcardHeaderMatcher"> <header-name>referer</header-name> </map:matcher> </map:matchers> <!-- Selectors are executed during pipeline setup. They can be used to determine which pipeline fragments should be combined. They are best compared with a switch statement in java. Matchers and actions are related concepts. Since this is important, let me repeat it: Selectors are executed during pipeline setup. --> <map:selectors default="browser"> <map:selector name="browser" src="org.apache.cocoon.selection.BrowserSelector"> <!-- # NOTE: The appearance indicates the search order. This is very important since # some words may be found in more than one browser description. (MSIE is # presented as "Mozilla/4.0 (Compatible; MSIE 4.01; ...") --> <browser name="explorer" useragent="MSIE"/> <browser name="pocketexplorer" useragent="MSPIE"/> <browser name="handweb" useragent="HandHTTP"/> <browser name="avantgo" useragent="AvantGo"/> <browser name="imode" useragent="DoCoMo"/> <browser name="opera" useragent="Opera"/> <browser name="lynx" useragent="Lynx"/> <browser name="java" useragent="Java"/> <browser name="wap" useragent="Nokia"/> <browser name="wap" useragent="UP"/> <browser name="wap" useragent="Wapalizer"/> <browser name="mozilla5" useragent="Mozilla/5"/> <browser name="mozilla5" useragent="Netscape6/"/> <browser name="netscape" useragent="Mozilla"/> </map:selector> <map:selector name="parameter" src="org.apache.cocoon.selection.ParameterSelector"/> <map:selector name="request" src="org.apache.cocoon.selection.RequestSelector"/> </map:selectors> <!-- Actions are executed during pipeline setup. Their purpose is to execute some arbitrary complex code. They are the work horses of pipelines. Use them to update databases, check external resources etc. The execution may fail or complete successfully. Only if the execution was successful, the pipeline fragment contained inside is used within the pipeline. Related concepts are matchers and selectors. Since this is important, let me repeat it: Actions are executed during pipeline setup. --> <map:actions> <map:action name="add-employee" src="org.apache.cocoon.acting.DatabaseAddAction"/> <map:action name="del-employee" src="org.apache.cocoon.acting.DatabaseDeleteAction"/> <map:action name="upd-employee" src="org.apache.cocoon.acting.DatabaseUpdateAction"/> <map:action name="lang-select" src="org.apache.cocoon.acting.LangSelect"/> <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"/> <map:action name="request" src="org.apache.cocoon.acting.RequestParamAction"/> <map:action name="form-validator" src="org.apache.cocoon.acting.FormValidatorAction"/> <map:action name="session-state" src="org.apache.cocoon.acting.SessionStateAction"/> <map:action name="session-isvalid" src="org.apache.cocoon.acting.SessionIsValidAction"/> <map:action name="resource-exists" src="org.apache.cocoon.acting.ResourceExistsAction"/> </map:actions> </map:components> <!-- =========================== Pipelines ================================= --> <!-- Pipelines. The beef. Pipelines specify, how the processing of your content is done. Usually, a pipeline consists of several fragments that specify the generation, transformation, and serialization of SAX events. Processing is done in two steps: 1) The top level elements are executed in order of appearance until one signals success. These top level elements are usually matchers. AFAIK other components are not supported for this. Other components are called depth-first to determine what fragments make up the processing pipeline. When a component fails, no nested components are called but the next component on the same level. 2) Once it is determined which generator, which transformers and wich serializer is used, these components are executed. During this, the pipeline may not be changed. You may have as many pipelines in your sitemap as you like. However, it seems that the only purposes would be to specify different error handlers. --> <map:pipelines> <!-- Utility for viewing source xml or html--> <map:pipeline> <map:match pattern="**.source"> <map:generate src="cocoon:/{1}" /> <map:transform src="stylesheets/simple-xml2html.xsl"/> <map:serialize/> </map:match> </map:pipeline> <!-- "automount" setup This causes directories added under "mount" (even with Cocoon already running) to be activated automagically if they contain a sitemap.xmap, without having to modify the main sitemap.xmap --> <map:pipeline> <map:match pattern="mount/*/**"> <map:mount uri-prefix="mount/{1}" src="mount/{1}/" check-reload="yes"/> </map:match> </map:pipeline> <!-- Pipeline for KNAPP Web more specific matchers must go first, then the matcher */** should be defined to process sub sitemaps --> <map:pipeline> <map:match pattern="*"> <map:match pattern="*" type="sessionstate"> <map:parameter name="attribute-name" value="user"/> <map:match pattern="**/*.css"> <map:read src="css/{2}.css" mime-type="text/css"/> </map:match> <map:match pattern="images/**.*"> <map:read src="images/{1}.{2}" mime-type="image/{2}"/> </map:match> <map:match pattern="**/*.js"> <map:read src="jscript/{2}.js" mime-type="text/javascript"/> </map:match> <map:match pattern="applets/**"> <map:read src="applets/{1}" mime-type="application/octet-stream"/> </map:match> <map:match pattern="*/**"> <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/> </map:match> </map:match> <map:redirect uri="login/login.xml"/> </map:match> </map:pipeline> </map:pipelines> </map:sitemap> <!-- end of file -->
msg20210/pgp00000.pgp
Description: PGP signature