httpurlconnection

I am trying http connection over android

一笑奈何 提交于 2019-12-11 20:33:53
问题 I am a newbie on android development and i am having this error message while testing to send an sms over http connection and get a return string. below is the http api: http://server:port/CreditCheck/checkcredits?username=xxxxx&password=xxxx I get java.io.ioexception , i dont know how to track further and it is really giving me headache. public class Sender { // Username that is to be used for submission String username; // password that is to be used along with username String password; //

Why it returns Internal Server Error on httpUrlConnection?

天大地大妈咪最大 提交于 2019-12-11 20:09:06
问题 I'm developing an application that can send different files to web server.Also I want to send large files, in able to do this I need to chunk the files. But when I'm sending the files to server nothing is uploaded. I don't know if there's error on how I'm sending the files and it gives an error 500 (internal server error) on my response.I don't think the server is the problem because when I'm uploading a file using multiPartEntity it works but when Im using BufferedInputStream and

Using HttpURLConnection on Android to submit to a Google Form

随声附和 提交于 2019-12-11 19:41:46
问题 I used the method in this question to post to a Google Spreadsheet form from my Android app. The method in the question uses the Apache HTTP Client which was removed in Android 6.0. While it is possible to use the Apache HTTP Client on Android 6.0, I'd like to implement the same functionally with HttpURLConnection. How can I post to a Google Spreadsheet form using HttpURLConnection? 回答1: I assume that the method you post a Google Spreadsheet is similar to the answer of this question. I

Get Response header when 401 occurred

点点圈 提交于 2019-12-11 19:40:03
问题 Hi I am working on android and java.So my problem is that whenever 401 occurred I am not able to get response header and also not able to get status code. I am using http url connection. My code looks like this: String https_url = "http://abc.com"; HttpsURLConnection con = null; int status; URL url; try { url = new URL(https_url); con = (HttpsURLConnection)url.openConnection(); con.setDoInput(true); int responseCode = con.getResponseCode(); //throw IOException:Received authentication

Telegram, Java: upload file to send in sendAnimation

微笑、不失礼 提交于 2019-12-11 18:55:50
问题 There's a method in Telegram API called sendAnimation . There are two obligatory paramteres: chat_id and animation . animation 's descriptio is this: Type : InputFile or String Description : Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More info on Sending Files » I have a local .gif file

How to handle non-UTF8 html page in Java?

假装没事ソ 提交于 2019-12-11 18:50:48
问题 My task is to retrieve html strings from urls using Java. I know how to using HttpUrlConnection & InputStream to get the string. However, I have an encoding problem for some pages. If some pages have different encoding (e.g., GB2312), other than UTF8, the string I get is just arbitrary chars or question marks. Can any one please tell me how to solve this problem? Thanks Below is my code to download the html from a url. private String downloadHtml(String urlString) { URL url = null;

Authentication in a client application for REST services

☆樱花仙子☆ 提交于 2019-12-11 15:55:46
问题 Firstly, I'm going to explain my objective: I developed some REST services using Jersey, that were automatically generated from my MySQL DataBase. In that DataBase I have a Login table, that have the information of who can access the REST services. With this Login table I've allready implemented Basic-Authentication for my Jersey REST services, and that's working. When I go to the REST services mainpage, I have to put the correct login and password, and then I can access all information of

Android Studio: retrofit2: multipart connection failure with image and strings

我只是一个虾纸丫 提交于 2019-12-11 12:27:12
问题 private void Dialog_profile_pic() { // create upload service client File file = new File(selectedImagePath); // create RequestBody instance from file RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file); // MultipartBody.Part is used to send also the actual file name MultipartBody.Part body = MultipartBody.Part.createFormData("memFile", file.getName(), requestFile); // add another part within the multipart request RequestBody description = RequestBody

Data not showing on Android Pie 9.0

☆樱花仙子☆ 提交于 2019-12-11 12:03:22
问题 After I updated my phone from Android Oreo 8.0 to Android Pie 9.0, I no longer can get data from MySQL database using HttpUrlConnection. I try with emulator Android Oreo 8.0 and the data is displayed. However, when I try with emulator Android Pie 9.0, the data is not displayed. Please help me. 回答1: I Recently had the same issue for Android 9, but I had to use some URLs for different screens. So I added android:usesCleartextTraffic="true" to Manifest and it worked, but we didn't want to

Java 6 HTTPURLConnection and Project Server NTLM Authentication from RHEL5.5

我的未来我决定 提交于 2019-12-11 11:09:44
问题 Currently at a loss for authenticating with a Microsoft Project Server 2007 instance running on IIS with Integrated Windows Authentication enabled from a Java 1.6(u19) client running on linux, RHEL 5.5. Note: The client works on my Windows workstation. I initially was trying to implement a JAX-WS call and found that I could not retrieve the WSDL due to authentication errors, specifically a 401.2, followed by a 500. So I simplified it to a Java class that: Creates an Authenticator and sets it