http request android,Android-HttpRequestBuilder

Android-HttpRequestBuilder DEPRECATED

HttpRequestBuilder is builder using HttpURLConnection.

no more commit.

Example

create builder

HTTPRequest.Builder mBuilder = new HTTPRequest.Builder(stringUrl);

set optional parameters

builder.setReadTimeoutMillis(10000);

builder.setConnectTimeoutMillis(15000);

builder.putParameter(name0, value0);

builder.putParameter(name1, value1);

builder.putParameter(name2, value2);

builder.setMethod("POST"); // or "GET"

build and get request object

HTTPRequest request = builder.build();

request

you MUST NOT use this method in UI thread

HTTPResponse response = request.request();

int responseCode = response.getCode();

String responseMessage = response.getResponseMessage();

String errorMessage = response.getErrorMessage();

License

Copyright 2015 Mabi

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this work except in compliance with the License.

You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

THE END
< <上一篇
下一篇>>