sogeti / droidnetworking Goto Github PK
View Code? Open in Web Editor NEWA networking library for Android.
A networking library for Android.
i want to use response cache data when my application is offline.... i tried everywhere but no any solutions are there... please help me...
I have detected that POST requests redirected from HTTP to HTTPS are converted to GET requests.
Redirections are ordered by Apache webserver with Redirect directive It produces responses with HTTP status 301 (Moved Permanently):
<VirtualHost myhost.com:80>
# Force HTTPS:
Redirect permanent / https://myhost.com/
</VirtualHost>
May be that changing the method is a security feature, or may be a bug. In any case, I have dig into DroidNetworking code and it seems a behavior from the org.apache.http namespace (I am not completly sure).
Hey there,
I'm very new to Android development and Java and I am trying out your networking library. I am wondering if I am setting this HashMap up correctly on a GET request that requires a string value and optional int value. If I don't pass an int value I get a response, however, passing the int value I do not get any response back meaning the onComplete and onError methods never fire in my OperationListener.
Is this a correct way to send params with string and int value?
HashMap params = new HashMap();
params.put("search", "myString");
params.put("limit", 2);
Hey is it possible to POST a parameter of type array? I'm not getting any response when I try to post a JSONArray with JSONObjects. I've also tried an ArrayList of HashMaps.
Example of params:
//params
HashMap params = new HashMap();
params.put("fromDate", "2014-03-20");
params.put("toDate", "2014-03-25");
params.put("rooms", jsonArray);//also tried jsonArray.toString();
Thank you!
It is not possible to get the response headers.
I need to invike a REST service that will output an answer only when the content-type of the request is form-data (specifically, "multipart/form-data") and the request type is POST. I have not full control of it.
I am trying to set the header and invoke with:
Map<String, String> params = new HashMap<String, String>();
HashMap<String, String> headers = new HashMap<String, String>();
params.put("nid", "21"); //I think it's irrelevant, but who knows
headers.put("Content-type", "multipart/form-data");
NetworkEngine.getInstance().setUseCache(false); //to avoid any error due to cache or stuff like that
NetworkOperation operation = NetworkEngine.getInstance().createOperationWithURLString("serviceUrl", params, HttpMethod.POST);
operation.addHeaders(headers);
operation.addParams(params); //doing it twice, just in case
operation.setListener(LoginActivity.this);
NetworkEngine.getInstance().enqueueOperation(operation);
The output by the server (404 service not found) makes me think that the request has not a right header or is not being executed as a POST Request, as it's the same output that I get on Chrome's Postman (https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm) when I invoke the service with a GET/PUT/DELETE request instead of a POST one.
By the way, with LoopJ's AsyncHTTPClient (http://loopj.com/android-async-http/) I get a right answer just by doing this:
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("nid", "21");
client.addHeader("Content-type", "multipart/form-data");
client.post("serviceUrl", params, new AsyncHttpResponseHandler() {
@OverRide
public void onSuccess(String response) {
System.out.println(response);
}
@OverRide
public void onFailure(Throwable t) {
t.printStackTrace();
}
});
}
Is there any step withing this library execution flow that may cause the headers being lost, or the request being invoked as get/put/delete instead of post?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.