If I read this correctly you are using an external java program to post to a tapestry page. Correct?

The error you are refering to is usually associated with the required return type from an event method which you have not shown in your post.

Can you post the page code handeling the POST request? For refference, below you will find the onActivate code of a page I use to handle external XML POST requests.

Cheers,
Joost

---------- a POST handling page ----------
@OnEvent(value = EventConstants.ACTIVATE)
    private Object activate() throws Exception {

HttpServletRequest httpServletRequest = requestGlobals.getHTTPServletRequest(); ServletInputStream inputStream = httpServletRequest.getInputStream();

        SAXBuilder builder = new SAXBuilder();
        Document xmlRequest = builder.build(inputStream);

        String response = ... build the response xml Document ....


final ByteArrayInputStream output = new ByteArrayInputStream(response.getBytes());

        final StreamResponse streamResponse = new StreamResponse() {

            public String getContentType() {
                return "text/xml";
            }

            public InputStream getStream() throws IOException {
                return output;
            }

            public void prepareResponse(Response response) {
            }
        };
        return streamResponse;
    }


On 8/11/10 11:36 AM, Khalid EL BOUKHARI wrote:
Hi,
I need to do POST in Tapestry for example :

<form method=*"POST"* Action=*"*MyURL*"* name=*"name"*>

             <input type=*HIDDEN* name=*"FirstParam"* id=*"IdFirstParam"*value=
*"*Value*FrstParam"*/>

             <input type=*HIDDEN* name=*"SndParam"* id=*"IdSndParam"* value=*
"*Value*SndParam"*/>

</form>


When I try :


String data = URLEncoder.encode("*FirstParam*", "UTF-8") + "=" +
URLEncoder.encode("*FirstParam*", "UTF-8");
                     data += "&" + URLEncoder.encode("*SndParam*", "UTF-8") +
"=" + URLEncoder.encode("*SndParam"*, "UTF-8");
// Send data
URL url = new URL(*MyURL*);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();

But Tapestry tell me that I must use :
java.net.URL, org.apache.tapestry5.Link, org.apache.tapestry5.
StreamResponse

Any one know how to do ?

Thanks in advance

*Khalid.*



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to