Using the Facebook Graph API from your GWT application

January 3, 2013 · 0 min · admin

Using Google App Engine as Backend for Android

If you’re looking for a way to create a backend for your Android application, Google App Engine looks like the perfect choice: You can use Java as you can do for Android and you don’t need to think too much about hosting, as it is all stored in the cloud. Another benefit is that you can reuse your transfer objects on the client and on server side. But as it is often there are some problems doing this in practice....

December 2, 2011 · 2 min · admin

Storing large images RESTful in the cloud using Google App Engine

In my last article I showed how to store files in the cloud using Google app engine. Problem there was that the maximum size of the files was 1MB. Not that much for images. To improve the situation, we just shrink the images with this very simple algorithm by factor 0.9 until the size is less than 1MB: public class FileTransformer { public static final Logger log = Logger.getLogger(FileTransformer.class.getName()); private static final int JPEG_QUALITY = 90; private static final int MAX_FILE_SIZE = 1024*1024; public byte[] transform(byte[] ba, String mediaType) { if(mediaType....

December 1, 2011 · 2 min · admin

Storing files RESTful in the cloud using Google App Engine

Do you want to store files RESTful in the cloud? Why not use the Google App Engine for it? Firstly you will need a entity class that is storing the file in the data store: @Entity public class FileEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long key; private Blob content; private String mediaType; public Long getKey() { return key; } public Blob getContent() { return content; } public void setContent(Blob content) { this....

December 1, 2011 · 2 min · admin

Using real POJOs (without JAXB Annotations) as transfer objects with JAX-RS

Are you annoyed that you have to annotate your POJOs with @XmlRootElement, so they can be used with JAX-RS? If your using Jersey as JAX-RS implementation your lucky: Just add to the <servlet> tag in your web.xml the following snippet: <init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value> </init-param> After restarting your servlet, your POJOs are marshalled to JSON as a charme. Enjoy!

December 1, 2011 · 1 min · admin