Answer the question
In order to leave comments, you need to log in
How to send a PUT request with ANDROID cookies?
I'm trying to send a PUT request to the server and attach cookies. The cookie server does not see, throws out for authorization. Through the Advanced REST client everything is fine, the request goes away. POST request also leaves normally cookies leave.
Code below
URL url1 = new URL("http://admin.carex.su/supplier_order_items/10117/add_income?qnt=1");
HttpURLConnection con2 = (HttpURLConnection) url1.openConnection();
con2.setRequestMethod("PUT");
con2.setRequestProperty("Cookie", mSettings.getString(APP_PREFERENCES_COOKIE, ""));
con2.setRequestProperty("Content-Type", "application/json; charset=utf-8");
con2.setRequestProperty("_method", "PUT");
con2.setInstanceFollowRedirects(false);
con2.connect();
int responseCode1 = con2.getResponseCode();
System.out.println("\nSending 'GET' request to URL : " + url1);
System.out.println("Response Code : " + responseCode1);
BufferedReader in1 = new BufferedReader(
new InputStreamReader(con2.getInputStream()));
String inputLine1;
StringBuffer response1 = new StringBuffer();
while ((inputLine1 = in1.readLine()) != null) {
response1.append(inputLine1);
}
in1.close();
con2.disconnect();
Answer the question
In order to leave comments, you need to log in
Design patterns are designed to solve specific problems and not just to make things beautiful. In the question you do not describe what problem you are trying to solve. What exactly is the problem? Do you know how to set the camera type when the class is created? Doesn't know how best to manage camera types? (and what is a type and how it is represented in your library is not clear
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question