I want to download a file from a Sharepoint server that protected with NTLM authentication from my Android application. I found some tutorials and couldn't successful.
I tried using The Java CIFS Client Library and did not successful again.
I investigated this post: Manipulating SharePoint list items with Android (JAVA) and NTLM Authentication but i do not want to consume a webservice, i just want to download a file.
Any suggestions?
Did you use standard Java java.net.Authenticator http://developer.android.com/reference/java/net/Authenticator.html? If it doesn't support NTLM check http://developer.android.com/reference/org/apache/http/auth/NTCredentials.html and related org.apache.http package. Also look at blog http://mrrask.wordpress.com/2009/08/21/android-authenticating-via-ntlm/ where it is shown how to use it. In par
Why complicate things
You should be able to send the authentication in the Uri.
URL url = new URL ("http://user:pass#sub.domain.com/FolderName/FileName.docx");
This technique should work with both Windows Authentication and Basic Authentication
Try using Chilkat, although it's not free. but you can easily implement it in your code.
Chilkat Link
Related
I know very little about writing code for a client that would access a website account. I've been to different websites that contain so much information that I am just lost. Here is what I found:
For the client to take advantage of, say, remote file operations on
a Dropbox account, Dropbox's cloud API needs to be integrated.
But to do that, the client needs to receive an authentication token
with the OAuth 2.0 protocol.
Before I can do that, I have to establish an HTTP connection between
the client and the cloud.
Before I do that, I need to use libcurl or Java SDK for Dropbox.
Before I decide on whether to use libcurl, Dropbox Java SDK, or Java
standard libraries, I need to find out which one is better for HTTP
and SMTP protocols.
Now, correct me if I'm wrong on any of the numbered points above.
Here's a question: what library or SDK would you recommend me for using both HTTP and SMTP protocols? (I would have chosen Dropbox's Chooser as pointed out in the thread Client-only Dropbox access, but that's a JavaScript component, and my custom client app needs to take care of authentication and handle HTTP and SMTP requests.)
Any help is appreciated.
I've chosen the Java SDK for the Dropbox cloud storage provider. As pallandt has pointed out, the page https://www.dropbox.com/developers/core/start/java could get you started on what to do first to employ the Dropbox Java SDK:
Save the complete Main class code on the page to a java file.
On the same page find the link "install the Java SDK".
Follow the instructions on that page.
From there on comes a part of actually employing the SDK. The thread Cannot install a jar package without an IDE has comments under the OP that go off into a chat, which you may find really helpful. You might have to use an IDE like Eclipse to facilitate the importation of "com.dropbox.core".
I have been researching this for a while now and never really found a simple solution. This morning i tried something really simple and it actually worked.
public void testDropboxConnection() {
Path tmpF = Paths.get(System.getProperty("user.home") + File.separatorChar + "Dropbox//folder//");
try {
Files.createDirectories(tmpF);
} catch (IOException ex) {
Logger.getLogger(RefineryData.class.getName()).log(Level.SEVERE, null, ex);
}
}
I tested this and it sync's perfectly
I am in a bit of a pickle, I need to use vosao with an Android application but I have no idea how to authenticate and use it, I have got the JSON-RPC part working by telling me if the username and password is correct but I don't know what to do from here
Vosao is a CMS for Google App Engine.
To get round this I used JSON to parse the response from the web server, then with the same HttpClient I did all my other requests :)
SardineFactory.begin(username, password);
sardine.exists("http://mydomain.sharepoint.com/TeamSite/Documents");
I thought sardine can login auto but it returns 403 error.
I didn't use sardine and SharePoint Online before.
Remote Authentication in SharePoint Online Using Claims-Based Authentication
I know i should do something else but don't know how.
Anyone can help me?
The SharePoint is most likely using Claims-Based Authentication, which is a nightmare to negotiate and authenticate through using Java.
Most solutions I've seen from others (although I have not yet seen a working demo) claim you have to use a .NET "mediator" in a non-CBA environment that your Java app can communicate with, and the "mediator" will in turn more easily get through the CBA authentication routine (keeping things within the .NET family).
Being stubborn, I am working on a pure Java solution and will post if I ever get it working.
So I want to write a servlet which uploads a video to a youtube channel using the Java API, but I can't seem to find a way of specifying that I want to go through a proxy server. I've seen an example on this site where someone managed to do this using C#, but the Classes they used don't seem to exist in the Java API. Has anybody managed to successfully do this?
YouTubeService service = new YouTubeService(clientID, developerKey);
I'm new here so I'm unable to comment on posts (and a little late on this topic), but Jesper, I believe this is the C# sample that the original poster was talking about: How to upload to YouTube using the API via a Proxy Server
I can see no "direct" way of porting that example to Java though, since the GDataRequestFactory doesn't seem to have any proxy-related fields.
I was also having issues with the Java client Library with proxy in our application. Basically, the library picks up the global Java proxy settings:
System.getProperty("http.proxyHost");
System.getProperty("http.proxyPort");
but for some reason not everywhere. To be more precise, even with a proxy server properly configured in Java, YouTube authentication (calling service.setUserCredentials("login", "pwd")) would use a direct connection and ignore the proxy. But a video upload (calling service.insert(...)) would use the proxy correctly.
With the help of folks at the official YouTube API mailing list, I was able to nail this down. The issue is that the authentication is performed using SSL (HTTPS) and since there is a different set of properties for the HTTPS proxy, this didn't work. The fix is to simply set https.proxy* properties as well (in addition to http.proxy*), so that these point to a valid proxy server too:
System.getProperty("https.proxyHost");
System.getProperty("https.proxyPort");
I need to download images from a website, and I have the login name and password, but if i just use URL to download the image, it will throw a exception: there is no value in session.
I think I need to login the website before I can programmatically download the image.
Do you have any solutions ? Thanks in advance !
In simple circumstances you can use a URLConnection with the URL and stream the contents down. More generally I'd strongly advise you use Apache HttpClient since you'll need to do authentication and possibly receive and send cookies to the server. Read the user guide regarding Authentication and Methods, particularly Get.
Use the HTTP Client libraries in order to write a spider for content access.
I would suggest to record the HTTP traffic for login and content access and then rebuild the communication using the library, if you want to stick with Java.
There are other libraries as well for other languages like Perl:LWP.
Although the java.net package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. HttpClient seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.
Designed for extension while providing robust support for the base HTTP protocol, HttpClient may be of interest to anyone building HTTP-aware client applications such as web browsers, web service clients, or systems that leverage or extend the HTTP protocol for distributed communication.
HTTPClient
HTTPClient Authentication
I'd like to mention HtmlUnit. It is a headless browser with Javascript for Java.