Yuri,
   instead of using the /FIleReceiver URL, do construct a URL by using
component resources in your page, e.g.

FileReceiver...:

public String getUploadUrl() {
        return
componentResources.createEventLink("fileUploaded").toAbsoluteURI();
    }

in your page template, use something like this to pass the URL to your
applet:

<applet .....>
   <param name="uploadUrl" value="${uploadUrl}" />
</applet>

Then, in your page, you can have a handler for the "fileUploaded" event:
    // from tapestry-upload, commons
    @Property
    private UploadedFile file;

   // alternatively, use the decoder
    @Inject
    private MultipartDecoder decoder;

onFileUploaded() {
   // do whatever you need here, tapestry-upload seems to work well
   String name = file.getName();
   // alternatively, using the decoder
   file = decoder.getFileUpload("Filedata");
}

   Let me know if this works for you.

Cheers,

Alex K

On Fri, Feb 27, 2009 at 3:00 AM, Yury Luneff <bitter...@ya.ru> wrote:

> Hello, users.
>
>       I'm trying to link a java applet to jetty/tapestry. I need to
>       pass data through POST request. I'm doing it like this:
>
>       URL url = new URL("http://localhost:8080/FileReceiver";);
>       System.out.println(url.toString());
>       HttpURLConnection connection = (HttpURLConnection) url
>                                        .openConnection();
>       connection.setRequestMethod("POST");
>       connection.setDoInput(false);
>       connection.setDoOutput(true);
>       connection.setUseCaches(false);
>       connection.setRequestProperty("Content-Type",
>                 "application/x-www-form-urlencoded; charset=utf-8");
>       PrintWriter pw = new PrintWriter(connection.getOutputStream());
>
>       and then filling the Pw. I'm not interested in input from
>       FileReceiver, so there is a "false" for that.
>
>       On the tapestry side i thought it would be possible to handle
>       this request somehow defining an event for FileReceiver, such
>       as onActivate or FileReceiver:receive onReceive. It reacts on
>       browser request, but not mine.
>
>       What is the right way of doing this (passing large data by
>       POST&java to tapestry application)? commons.httpclient is 50
>       times bigger than applet itself :)
>
> --
> Best regards,
>  Yury
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to