I have got to downl开发者_开发知识库oad a zip file from a server using HTTP Authentication in my Scala project.I have the following two questions.
1.) Is there any Scala or Java library that i can use for file download involving Http Authentication ?
2.) Also, any Scala library i can use for unzipping the folder ?
Please Help Thank You.
HttpClient is able to handle authentication. Apache Commons Compress can handle multiple zip formats.
1) You can use http dispatch (http://dispatch.databinder.net/About) which is a scala layer around HttpClient
2) To my knowledge there is no scala-specific api, but the java.util.zip.ZipFile provides a capable java-api you can use
I did not test this but maybe you could just use java.net.URL and embed the username/password in the URL:
val url = new java.net.URL("http://username:password@www.example.net/zipfile")
val connection = url.openConnection()
精彩评论