You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Geert Van Damme <ge...@vdab.be> on 2003/07/28 15:37:17 UTC

action vs transformer --> request attributes

Hi,

I'm writing an action to make request attributes available to the sitemap (like the RequestParamAction does for request parameters)

Problem is in the action the attributes don't seem to be available ???
Sitemap looks like follows :

			 <map:act type="env">
				 <map:parameter name="accor.bestellingen.local.filename" value="localfilename"/>

				 <map:transform type="filewriter">
					 <map:parameter name="filename" value="{localfilename}"/>
				 </map:transform>
			 </map:act>

			 <map:act type="request-attributes">
					<map:transform type="ftp-put">
						<!-- required -->
						<map:parameter name="host" value="localhost"/>
						<map:parameter name="username" value="test"/>
						<map:parameter name="password" value="test"/>
						<map:parameter name="filenameFrom" value="{filename}"/>
						<map:parameter name="filenameTo" value="{filename}"/>

						<!-- not required -->
						<map:parameter name="errortag" value="error"/>
					</map:transform>
			 </map:act>

The filewriter (= custom transformer, doesn't matter) puts an attribute on the request.
In the ftp-put transformer, I can get back the correct value from the request attribute, but would rather have the action making the attribute(s) available to the sitemap.

Following code returns null in the action :
		HttpRequest request = (HttpRequest)ObjectModelHelper.getRequest(objectModel);
		System.out.println ("attribute filename = " + request.getAttribute ("filename"));
while the same code in the Transformer returns the (correct) previously set value...

Any ideas ??




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


Re: action vs transformer --> request attributes

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 28.Jul.2003 -- 03:37 PM, Geert Van Damme wrote:
> 
> Hi,
> 
> I'm writing an action to make request attributes available to the sitemap (like the RequestParamAction does for request parameters)
> 
> Problem is in the action the attributes don't seem to be available ???

<snip/>

> The filewriter (= custom transformer, doesn't matter) puts an attribute on the request.
> In the ftp-put transformer, I can get back the correct value from the request attribute, but would rather have the action making the attribute(s) available to the sitemap.

This is correct behaviour.

Please see my today's answers to Lionel Crine under the subject
"trouble with session attribute" for an explanation.

	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

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


Re: action vs transformer --> request attributes

Posted by Alex Romayev <ro...@yahoo.com>.
Hi Geert,

Have you looked into input modules -- you can be using
sytax like:

<map:parameter name="username"
value="{request:username}"/>

Cheers,
-Alex

--- Geert Van Damme <ge...@vdab.be> wrote:
> 
> Hi,
> 
> I'm writing an action to make request attributes
> available to the sitemap (like the
> RequestParamAction does for request parameters)
> 
> Problem is in the action the attributes don't seem
> to be available ???
> Sitemap looks like follows :
> 
> 			 <map:act type="env">
> 				 <map:parameter
> name="accor.bestellingen.local.filename"
> value="localfilename"/>
> 
> 				 <map:transform type="filewriter">
> 					 <map:parameter name="filename"
> value="{localfilename}"/>
> 				 </map:transform>
> 			 </map:act>
> 
> 			 <map:act type="request-attributes">
> 					<map:transform type="ftp-put">
> 						<!-- required -->
> 						<map:parameter name="host" value="localhost"/>
> 						<map:parameter name="username" value="test"/>
> 						<map:parameter name="password" value="test"/>
> 						<map:parameter name="filenameFrom"
> value="{filename}"/>
> 						<map:parameter name="filenameTo"
> value="{filename}"/>
> 
> 						<!-- not required -->
> 						<map:parameter name="errortag" value="error"/>
> 					</map:transform>
> 			 </map:act>
> 
> The filewriter (= custom transformer, doesn't
> matter) puts an attribute on the request.
> In the ftp-put transformer, I can get back the
> correct value from the request attribute, but would
> rather have the action making the attribute(s)
> available to the sitemap.
> 
> Following code returns null in the action :
> 		HttpRequest request =
>
(HttpRequest)ObjectModelHelper.getRequest(objectModel);
> 		System.out.println ("attribute filename = " +
> request.getAttribute ("filename"));
> while the same code in the Transformer returns the
> (correct) previously set value...
> 
> Any ideas ??
> 
> 
> 
> 
>
---------------------------------------------------------------------
> 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