Im trying to make a url encoder app. I tried to use java.net.urlencoder but I cant find its buildr, direct importing doest work for me also same problem from httpclient.
Can you give some working gradle/maven about java.net or http client
Related
mySimpleDraweeView.setImageURI(Uri.parse("http://cdn.cnn.com:80/cnn/.e1mo/img/4.0/logos/menu_politics.png"));
This is a url from link preview for cnn. It is an http url and not an https url. It has a port :80 in the path.
If I throw that url into a webbrowser, it gets resolved as "http://cdn.cnn.com/cnn/.e1mo/img/4.0/logos/menu_politics.png" and an image is there.
If I try to call setImageURI with "http://cdn.cnn.com/cnn/.e1mo/img/4.0/logos/menu_politics.png" from the web browser, it still doesn't work.
If I try to call setImageURI with "https://cdn.cnn.com/cnn/.e1mo/img/4.0/logos/menu_politics.png" it works.
I'm using a custom OKHttp3 OkHttpClient for Fresco. I tried using the getUnsafeOkHttpClient described here https://stackoverflow.com/a/25992879/1578222, but did not see a change in behavior with it.
I also tried setting the OkHttpClient.followRedirects but it did not fix it either:
httpClient.followSslRedirects(true);
httpClient.followRedirects(true);
I found a log message from the OKHttp3 client and that helped me figure out the problem:
<-- HTTP FAILED: java.net.UnknownServiceException: CLEARTEXT communication to cdn.cnn.com not permitted by network security policy
Solved my changing the Android Manifest file's Application object to include:
android:usesCleartextTraffic="true"
you can use any external library like Picasso and then show the image by using it
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
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 :)
I have been directed here by someone from the Google Blogger Developer group. My question is basically, what is the best way to authenticate with the Blogger service within Android.
Initially I used HTTPURLConnect in Java and sent requests and received responses, this worked fine when the correct username and password were provided, however, when an incorrect password was supplied rather than being given the response Error=BadAuthentication, Java threw a FileNotFoundException for https:// www.google.com/accounts/ClientLogin. My plan obviously being to parse the response given by Google (according to this list: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Response)
The second attempt I have used this library:
http://code.google.com/p/google-api-java-client/
However, here I get the following error (regardless of credentials):
02-11 16:57:46.515: INFO/dalvikvm(294): Could not find method
org.codehaus.jackson.JsonParser.getCurrentToken, referenced from
method
com.google.api.client.googleapis.json.JsonCParser.parserForResponse
If anyone could provide any insight at all into these errors OR a better way to implement an application where user on Android can login and then read/view/create/edit blog posts on Blogger using the GData API, I'd be hugely grateful.
Thanks,
Tim.
Try adding the google-api-client-1.2.2-alpha.jar (or the version of the API you are using) to the Build Path:
If you're using Eclipse:
Right Click on your project and go to Properties.
Go to Java Build Path in the left bar. Choose the Libraries tab and then "Add External Jar...".
Add the google-api-client-1.2.2-alpha.jar file and try to run again.
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");