You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Olivier GUCKERT <Ol...@loria.fr> on 2003/06/12 09:52:36 UTC

use an http attribute in an action

Hello all,

Y have a HTTP request like :
chargement-decision.html?numero=3805&protection=inter and y want to use
the numero and protection attributes in an action. 

Do some one know how to do that ?


Thanks

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


Re: use an http attribute in an action

Posted by Lionel Crine <cr...@4dconcept.fr>.
Here is what I did from a post (input type="file"). I don't know if this 
that you need!!



this is the upload of an illustration :

Request request = ObjectModelHelper.getRequest(objectModel);
Enumeration e = request.getParameterNames();

while (e.hasMoreElements()) {
String param = (String) e.nextElement();
Object value = request.get(param);


//get the name of the document
String fileName = null;
if (value instanceof FilePart) {
fileName = ((FilePart) value).getFileName();
}

//get the content from the post
if (value instanceof FilePartArray) {
FilePartArray fpa = (FilePartArray) value;
InputStream is = fpa.getInputStream();
int size = is.available();
byte[] b = new byte[size];
try {
is.read(b);
}
finally {
is.close();
}

....

Lionel




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


Re: use an http attribute in an action

Posted by Olivier GUCKERT <Ol...@loria.fr>.

Lionel Crine a écrit :
> 
> you can try :
> 
> public Map act (Redirector redirector, SourceResolver resolver, Map
> objectModel, String src, Parameters parameters)
> throws Exception {
> Request request = ObjectModelHelper.getRequest(objectModel);
> String num = request.getParameter("numero");
> String protection = request.getParameter("protection");
> ...
> 
 Ok Thanks, it works fine but i could'nt get it to works because my pipe
was requested by a post method and i read somewhere in the list it was
impossible to get it to work so...

So i resolve my problem by using a redirect.

Olivier

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


Re: use an http attribute in an action

Posted by Lionel Crine <cr...@4dconcept.fr>.
you can try :

public Map act (Redirector redirector, SourceResolver resolver, Map 
objectModel, String src, Parameters parameters)
throws Exception {
Request request = ObjectModelHelper.getRequest(objectModel);
String num = request.getParameter("numero");
String protection = request.getParameter("protection");
...



At 09:52 12/06/2003 +0200, you wrote:
>Hello all,
>
>Y have a HTTP request like :
>chargement-decision.html?numero=3805&protection=inter and y want to use
>the numero and protection attributes in an action.
>
>Do some one know how to do that ?
>
>
>Thanks
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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