robotoworks / mechanoid

Eclipse plugin providing a set of DSL's for the rapid development of Android apps
58 stars 26 forks source link

Net with binary result #234

Closed hannesa2 closed 1 year ago

hannesa2 commented 10 years ago

Is it possible to request binary data like

/v1/book:String/image

get getImage /v1/book:String/image {
  params 
    width: int, 
    height: int
  response ?? <- which type
}
fluxtah commented 10 years ago

Hey hannesa2,

Unfortunately not, however this would be a great addition, I will look at trying to support a response type binary.

hannesa2 commented 10 years ago

It would be a really great addition ! Till now I've to use MultipartEntity for POST, but GET is more easier to request. For a first step I'm happy with GET binary type for not leaving mechanoid for this request

hannesa2 commented 10 years ago

I've no idea how to expand DSL for the new response type, this is my blocking point to make a new pull request. At my point of view, the best response type is a stream, otherwise everything is in memory, and this can be very dangerous on large objects.

fluxtah commented 10 years ago

Rather than update the grammar you could make getInputStream() method public:

https://github.com/robotoworks/mechanoid/blob/master/libs/mechanoid/src/main/java/com/robotoworks/mechanoid/net/HttpUrlConnectionResponse.java

Then you can just read off the input stream instead of calling response.parse();