binary output for regular web requests
See original GitHub issueDescribe the feature
I’m looking at porting some web services from SparkJava to Javalin. The catch is that some of these services return generated image types (PNG, etc.). In SparkJava, you can say response.type("image/png"); return imageBytes;
, but there’s no equivalent in Javalin to just take a raw array of bytes and emit them as the HTTP response body.
Additional context
To some extent, all you need is a result(byte[])
in addition to the present result(String)
method. I suppose you could have an image(BufferedImage)
method that deals with the java.awt.BufferedImage
class, figuring out the appropriate content type automatically.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Sending and Receiving Binary Data - Web APIs | MDN
Receiving binary data in older browsers ... The loadBinaryResource() function shown below loads binary data from the specified URL, returning it ...
Read more >binary output for regular web requests · Issue #849 · javalin ...
I'm looking at porting some web services from SparkJava to Javalin. The catch is that some of these services return generated image types...
Read more >Working with binary media types for REST APIs
In API Gateway, the API request and response have a text or binary payload. ... is a list of content types that your...
Read more >Binary data - HTTPie 3.2.1 (latest) docs
Binary data is suppressed for terminal output, which makes it safe to perform requests to URLs that send back binary data. Binary data...
Read more >Python HTTP Request Binary Data using Requests
The curl -d switch sends a POST request, but you are using requests.get() instead, sending a GET request (whose body is ignored).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, I’ll build something.
https://github.com/tipsy/javalin/pull/851