It sounds like you want to send a xml file to the client not upload an xml
file. If so, you can use the standard XML document classes (see the
org.w3c.dom package). Build up your document then you can convert it to a
String using an empty Transform (see the javax.xml.transform and javax.xml
packages).
Make sure you set the header:
         Content-Disposition: attachment; filename=<file name.ext>

(Google Content-Disposition and Forcing Save As for more info).

Be aware that you only have 30 seconds in which to do this. Also, there is a
10 MB limit on the download so you might want to compress it before sending
it. Google's infrastructure will compress if the requester indicates it can
handle it, but I'm not sure if the 10MB limit is measured before or after
compression takes place (Anyone know the answer to this). My guess is that
it is measured against the data that is returned from your servlet before
the compression.

If you can't get it to work within the 30sec/10MB limits, you might have to
pre-build your document using a task which when 1.4 is released will give
you a 10 minute window to create the file and then can store the file in the
Blobstore.

Stephen

On Mon, Nov 29, 2010 at 10:14 AM, Didier Durand <[email protected]>wrote:

> Hi,
>
> To emulate files, you have to use the Blob object in the datastore to
> store such xml content: see com.google.appengine.api.datastore.Blob in
>
> http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Core_Value_Types
>
> Blob has a limited max size: 1 Mbyte. So, you can use a collection
> (Vector, List, etc..)  of Blobs if you need more than 1 Mbytes.
>
> If your files get uploaded by a client, you can use the Blobstore
> where the max size is much bigger(2 Gbytes): see
> http://code.google.com/appengine/docs/java/blobstore/overview.html
>
> You have to associate the blob with some other fields (name, size,
> last_updated) in you pojo to reproduce what you expect from a file.
>
> N.B. if you need to emulate a directory tree, you also have to write
> it by yourself.
>
> Finally, I would recommend alternative Objectify rather than standard
> JDO for such services.
>
> Hope this helps
>
> regards
> didier
>
> On Nov 29, 5:53 pm, pac <[email protected]> wrote:
> > In a website I need to provide a feature to get data in xml format
> > i.e. some url
> >
> > e.g.http://www.mysite.com../data.xml
> >
> > I think in gae I can not create a file. Any suggestions to create such
> > feature to get data from data store in this way?
> >
> > Data store will have large number of records, so in general, a file
> > created from that could be of good few MBs.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-appengine-java?hl=en.

Reply via email to