cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Per Kreipke" <...@onclave.com>
Subject RE: Cocoon and HTTP POST
Date Fri, 08 Sep 2000 21:32:15 GMT
> At 17:06 -0400 07/09/00, Per Kreipke wrote:
> >Newbie Q:
> >I'm wondering if Cocoon can handle POSTS as well as GETs. Which
> sample would
> >I look at?
>
> There are no examples that directly distinguish between POST and other
> methods, ie. with java code inside the XSP, but the FP Taglib
> provides this
> functionality with a Tag <fp:if-post></fp:if-post> and
> <fp:if-get></fp:if-get>.
>
> Whether you want to use the rest of FP or not, you can still use
> this Tag ...
>
> Basically to write this in Java, you'd do something like this:
>
> <xsp:logic>
> 	if ("POST".equalsIgnoreCase(request.getMethod())) {
> 		// your POST handling
> 	} else {
> 		// your GET etc. handling
> 	}
> </xsp:logic>
>
> or with the FP Tags:
>
> <fp:if-post>
> 	<!-- your "POST" output -->
> </fp:if-post>
>
> <fp:if-get>
> 	<!-- your "GET" output -->
> </fp:if-get>
>
> You can extract form values like this:
>
> 	<request:get-parameter name="fieldName" default="default value"/>
>
> BTW. Using the default value is very useful for checkboxes etc, as it
> allows you to have a default value in the case that the checkbox was
> unchecked ...
>
> ie <request:get-parameter name="myCheckBox" default="false"/>
>
>
> Hope this helps
>
> regards Jeremy


It does, it does. Thanks for the XSP/XSLT hints!

Let me ask a follow up question. Suppose the POST content type wasn't
"application/x-www-form-urlencoded" (e.g. not form elements).

Specifically, suppose it was "text/xml", how would you recommend going about
implementing processing the contents and spitting back an XML reply? E.g. a
messaging framework:

>From client:
<request>
 <content>This is my message</content>
</request>

To client:
<reply>
 <content>No one's home</content>
</reply>

I'm thinking that cocoon would be really good for this type of server.

I'm thinking it's a 'producer', but I'd be much happier just implementing a
logicsheet to do this.

Insights?

Per.


Mime
View raw message