Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration into spring boot #73

Open
VincentHQL opened this issue May 17, 2019 · 4 comments
Open

Integration into spring boot #73

VincentHQL opened this issue May 17, 2019 · 4 comments

Comments

@VincentHQL
Copy link

Can it be integrated into Spring boot?

@certainmagic
Copy link
Contributor

Hi Vincent --

I'm not really familiar with Spring Boot. I know it's a java framework. I know b2-sdk-java works for java programs, so I'm pretty sure it will work. And I suspect the devil is in the details. :)

Which particular details are you concerned about? In issue #65, Dominik has pointed out that he can't put the InputStream that's given to a B2ContentSink into a ResponseEntity because the SDK closes the input stream after B2ContentSink.readContent() returns.

I've asked Dominik if he can just ask our SDK for the download url (and, if needed, some credentials) and create a ResponseEntity with that -- either by redirecting, or by opening an InputStream using the url (and maybe credentials) directly using a normal HTTP API.

thanks,
ab

@certainmagic
Copy link
Contributor

Hi Vincent --

How is it going? Do you have any further questions?

thanks,
ab

@VincentHQL
Copy link
Author

Hi
I call the HTTP API directly. I recommend providing a temporary key for clients to upload files directly.

browser ---> Web Server ----> temp key
browser ---> b2Stor

Browser calls server interface to return zero-time token, browser uploads files directly to B2.

Example:

https://help.aliyun.com/document_detail/31926.html?spm=a2c4g.11186623.6.1267.2c2749e8Zg6n52

@certainmagic
Copy link
Contributor

Hi Vincent --

I'm not sure if you're saying that you gotten it working or whether you think we're missing something you need. I believe that you can do what you want today:

  • Your server can call get_upload_url and provide the uploadUrl and authorizationToken to the web page.
  • Your web page can POST the content with b2_upload_file.

I think the one thing you mentioned that's not currently provided is a way to make a time limit on the upload url's authToken. (We provide the ability to make a download url that expires.)

ps. Remember to configure the CORS rules on the bucket you're uploading to, so that web pages on your site will be able to upload to your bucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants