You can achieve the same result a different way, but with two network
calls. The first, a regular RPC call that uploads the data and returns
some unique ID. The second is an HTTP call that goes to your non-GWT
servlet and passes in the ID from the first call as a parameter, and the
file is returned for the browser to handle as normal.

HTH
Paul

Andrey wrote:
> Jason,
>
> this is exactly what I was thinking of. My question is how to do this
> part: "have a field that contained the serialized rpc style data"? How
> can I rpc-serialize it?
> BTW I want to download the file not to upload it. So I will not need
> to decode on client, only encode on client and decode on server
>
> On 6 ноя, 20:16, Jason Essington <[email protected]>
> wrote:
>   
>> Actually, the process would be to construct a form post (not a XHR)  
>> since that is the only way in Javascript/html to upload a file. you  
>> could have a field that contained the serialized rpc style data ...
>>
>> then on the server break out the fields ... handle the files and  
>> deserialize the other bits. then serialize a response and return it.
>>
>> on the client, the target iframe would have to handle the returned  
>> text as RPC data and deserialize it.
>>
>> I don't think that any of this is built into GWT at the moment, but it  
>> would be possible to create it.
>>
>> I have created form posts with RPC responses in the past, so it is a  
>> short hop to add the rpc style request parameters.
>>
>> -jason
>>
>> On Nov 6, 2009, at 6:48 AM, Sripathi Krishnan wrote:
>>
>>     
>>> Can't do it via GWT RPC. As you said, you can bypass things on the  
>>> server, but GWT doesn't have any client side hooks to get raw bytes.
>>>       
>>> In fact, I am not sure if you can do that using a XmlHttpRequest.  
>>> How will the user save the file, if the data is available as a  
>>> javascript variable?
>>>       
>>> There is an older discussion on this group - someone wanted to  
>>> download an image from the servlet but pass in parameters using GWTs  
>>> RPC request. The conclusion was similar - it can't be done.
>>>       
>>> --Sri
>>>       
>>> 2009/11/6 Andrey <[email protected]>
>>>       
>>> I'm using GWT 1.7
>>>       
>>> On 6 ноя, 14:15, Andrey <[email protected]> wrote:
>>>       
>>>> Hi,
>>>>         
>>>> I want to create a servlet that is downloading some file to client.
>>>> So, I cannot use RPC services for that. Servlet will take a lot of
>>>> data from client, so request should be POST. I want to use built-in
>>>> RPC serialization mechanizm to encode my parameters. On server, I  
>>>>         
>>> can
>>>       
>>>> use com.google.gwt.user.server.rpc.RPC class to decode the request  
>>>>         
>>> and
>>>       
>>>> get the parameters. But how can I encode them on client? I've been
>>>> unable to fetch SerializationStreamWriter instances or something.
>>>>         
>>>> In short, I want RPC-request without RPC-response (servlet will be
>>>> writing a file in output stream instead).
>>>>         
>>>> Hope, I've been clear enough..
>>>>         
>>>> Thanks in advance,
>>>> Andrey
>>>>         

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to