SOBotics / Redunda-lib-java

A Java-library to communicate with Redunda
https://redunda.sobotics.org
MIT License
2 stars 1 forks source link

Track binary files #12

Open FelixSFD opened 7 years ago

FelixSFD commented 7 years ago

In some cases, it might be useful to track a binary file. (SOBotics/Guttenberg#100)

The current methods only send strings

NobodyNada commented 7 years ago

You can upload binary files to Redunda; just be sure to set the Content-Type to application/octet-stream.

FelixSFD commented 7 years ago

Great! :-) Thanks. I didn't know that

FelixSFD commented 7 years ago

@NobodyNada I'm trying to send a file with this method, but the server returns status 500.

file.getData() returns byte[]

NobodyNada commented 7 years ago

@FelixSFD Hmm, what's the response body?

NobodyNada commented 7 years ago

Also, what's the size of the file you're sending? IIRC there's a size limit, but I don't remember what it is :/

FelixSFD commented 7 years ago

I don't receive the response body, because con.getInputStream() throws the IOExcpetion before I can read the body. :-/

java.io.IOException: Server returned HTTP response code: 500 for URL: https://redunda.sobotics.org/bots/data/._slash_target_slash_guttenberg_dash_0.8.0.jar?key=aa6...87e7
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.sobotics.redunda.DataService.pushFile(DataService.java:194)
    at org.sobotics.guttenberg.clients.Client.main(Client.java:116)

The size is 10.3 MB

NobodyNada commented 7 years ago

@FelixSFD Hmm, [status-norepro]. Can you try to figure out a way to get the response body, as that should contain the error message? Does this SO answer help?

FelixSFD commented 7 years ago

Mysql2::Error: MySQL server has gone away: ROLLBACK

That's the full response: response.txt

NobodyNada commented 7 years ago

@FelixSFD ...That's a weird error. I'll take a closer look later, but I'll probably end up having to ask Undo or Art. FYI that error page includes your instance key, so you'll need to revoke it and generate a new one. Just click on the "Revoke" button on the instance key dialog.

ArtOfCode- commented 7 years ago

@FelixSFD Try again - it may have been related to the disk space problem we had earlier on today.

FelixSFD commented 7 years ago

@ArtOfCode- no. :-/ Still the same error

Bhargav-Rao commented 6 years ago

Any update on this?

FelixSFD commented 6 years ago

No. :-( I think I should try to set up a local test instance of Redunda to debug this

Am 14.07.2018 um 22:05 schrieb Bhargav Rao notifications@github.com:

Any update on this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

FelixSFD commented 6 years ago

This happens when I post the JAR-file:

Started POST "/bots/data/target_slash_guttenberg_dash_1.2.2.jar?key=9e8b9907a47f84375e14d03ea746ef8f68869c03e5ee73147e6df2c9e33835c2" for 127.0.0.1 at 2018-07-16 20:39:27 +0200

Rack::QueryParser::InvalidParameterError (invalid byte sequence in UTF-8):

rack (2.0.1) lib/rack/query_parser.rb:72:in `rescue in parse_nested_query'
rack (2.0.1) lib/rack/query_parser.rb:60:in `parse_nested_query'
rack (2.0.1) lib/rack/request.rb:468:in `parse_query'
rack (2.0.1) lib/rack/request.rb:343:in `POST'
actionpack (5.1.0.beta1) lib/action_dispatch/http/request.rb:359:in `block (2 levels) in POST'
actionpack (5.1.0.beta1) lib/action_dispatch/http/parameters.rb:99:in `block in parse_formatted_parameters'
actionpack (5.1.0.beta1) lib/action_dispatch/http/parameters.rb:99:in `fetch'
actionpack (5.1.0.beta1) lib/action_dispatch/http/parameters.rb:99:in `parse_formatted_parameters'
actionpack (5.1.0.beta1) lib/action_dispatch/http/request.rb:358:in `block in POST'
rack (2.0.1) lib/rack/request.rb:57:in `fetch'
rack (2.0.1) lib/rack/request.rb:57:in `fetch_header'
actionpack (5.1.0.beta1) lib/action_dispatch/http/request.rb:357:in `POST'
actionpack (5.1.0.beta1) lib/action_dispatch/http/parameters.rb:53:in `parameters'
actionpack (5.1.0.beta1) lib/action_dispatch/http/filter_parameters.rb:41:in `filtered_parameters'
actionpack (5.1.0.beta1) lib/action_controller/metal/instrumentation.rb:21:in `process_action'
actionpack (5.1.0.beta1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.1.0.beta1) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.0.beta1) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.0.beta1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.0.beta1) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.0.beta1) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.0.beta1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.0.beta1) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.0.beta1) lib/action_dispatch/journey/router.rb:46:in `block in serve'
actionpack (5.1.0.beta1) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.0.beta1) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.0.beta1) lib/action_dispatch/routing/route_set.rb:840:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.0.beta1) lib/active_record/migration.rb:558:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.0.beta1) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.0.beta1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.0.beta1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.0.beta1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.0.beta1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.0.beta1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.0.beta1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.0.beta1) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.0.beta1) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
railties (5.1.0.beta1) lib/rails/engine.rb:522:in `call'
puma (3.7.1) lib/puma/configuration.rb:232:in `call'
puma (3.7.1) lib/puma/server.rb:578:in `handle_request'
puma (3.7.1) lib/puma/server.rb:415:in `process_client'
puma (3.7.1) lib/puma/server.rb:275:in `block in run'
puma (3.7.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

(don't worry, the key is for my local copy of Redunda)

NobodyNada commented 6 years ago

Are you sure the Content-Type is application/octet-stream?

FelixSFD commented 6 years ago

I was sure, but I was wrong :-D It works!