Skip to content

Instantly share code, notes, and snippets.

@segfault87
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save segfault87/ac0877f1afb3a6f8e19b to your computer and use it in GitHub Desktop.
Save segfault87/ac0877f1afb3a6f8e19b to your computer and use it in GitHub Desktop.
@RpcObject(
method = HttpRequest.Methods.POST,
uri = "/post_image",
requestSerializer = MultipartFormDataEncoder.class)
public class PostImage {
// File name is set automatically and MIME type is determined by its extension
@RequestBody public File image;
}
@RpcObject(
method = HttpRequest.Methods.POST,
uri = "/post_images",
requestSerializer = MultipartFormDataEncoder.class)
public class PostMultipleImages {
// Name is set to images[0], images[1], ...
@RequestBody public List<File> images;
}
@RpcObject(
method = HttpRequest.Methods.POST,
uri = "/post_something",
requestSerializer = MultipartFormDataEncoder.class)
public class PostSomething {
// Content-Type is set to application/octet-stream in this case
@RequestBody public InputStream arbitraryData;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment