Java in Google App Engine: alternative for fileoutputstream - java

So I have a Java project that gets a content through an API request. Then, it saves the content in a file, which it uploads using another API. Now I want to use the Google App Engine, which doesn't support the fileoutputstream. I know you can use the datastore, but it can't really save a file.
Is there an alternative for this problem?

Related

How to generate .h files for embedded app using java android app

I am working on an android app, this app reads the data from an XML file and then based on the data, it performs some functionality. Now, I want to save a subset of data from the app to a header file, in such a way that if we import the created header file we can perform the functionality associated with the subset of that particular data in another application.
I want to use .h file so that I can reuse the same file for another embedded application as well. Obviously I need to write a parser for that.
Any suggestion will be appreciated in this regard

Can docx4j work in google app engine

I want to create an application deployed into the google app engine and I want to use the docx4j library. My application will read in a preexisting docx file (perhaps from a database) and then parse the docx document and replace some content, before outputting the final version as a PDF (also stored in a database)
I know app enine has a quite a few restrictions on what can and cannot run, and I will be using Java to do this. I know it does not allow writing to the filesystem, hence my comment about needing to get the input file and generating the output file into a database.
Does anyone know if the docx4j library, and it's dependencies, will be allowed to run in the app engine environment?
Thanks!
Java is one of the languages that is supported in both of the Google App Engine environments: standard and flexible. Go to these GCP docs to check the differences between those and choose the environment suitable for you. You can use Maven to handle your dependencies (the Docx4J library is available in Maven Repository).
When it comes to storing your files, you have a few options that can be used with Google App Engine app: Google Cloud Datastore, Google Cloud SQL and Google Cloud Storage. Their comparison can be found in GCP docs here.

Google App Engine is not picking up Log4j

Google App Engine does not create a file when using the file appender.
Google App Engine simply does not provide access to the file system. You can read from within your web-application, but you can't write anywhere. Those restrictions are the same for any framework you are using.
Most common example: you can upload file only with File Streaming API, without storing actual file in some temporary folder.

Use Google Docs API to download file of any type

Is it possible to download files of any type from Google Docs using the Google Docs API? (jpg, zip, txt)
I can figure out how to download word, powerpoint, and excel files but want to be able to upload and download any type of file to Google Docs. I know it is possible to do this with the online uploader but can't seem to get the downloading part to work with the API.
I'm using the Java wrapper to the API. Is it possible to use the Java version of the API to download all file types?
Since the last answer was written, that API is deprecated. There's sample Java code on the Google Dev page for the (newer) Google Drive API for managing downloads from Google Docs.
This handles a large variety of MIME types.
See this page http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html
and this for specifically downloading documents and files
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#DownloadingDocsAndFiles
The document listing XML returned by google has file type and the URL to download the file in the node. You can use the URL to download the file contents.

How to create an excel file in google app engine (java)?

A question that seems to have quite a few options for Python, but none for Java after googling for two days. Really really could use some help all I have found so far is a recommendation to use gaeVFS to build an excel file from the xml components and then zip it all together which sounds like a slap in the face. Oh yes and if you were wondering I am questioning my use of Java rather than python but at 5,000 lines of code it would be insane to turn back now...
Other things you might find useful
Client: GWT
Server: Servlets running
on google app engine storing data
into the google data store
Excel file: mandatory, CSV isn't good
enough, no need to save the file just
to be able to "serve" it to the
client i.e. open a "Save As" box.
Have you checked out this api already: Java Excel API ?
You could also take a look at the Apache POI project. You can read and write MS Excel documents with this library.
Take a look at this post.
It's a step by step tutorial on how to generate excel files on google app engine.
Try this :
http://code.google.com/p/gwt-table-to-excel/
google app engine do not support input/output stream classes, you need to use google app engine virtual file system.

Categories

Resources