Login Interface Andriod Simple HTTP GET request (with server side) two

Source: Internet
Author: User

</pre><pre name= "code" class= "Java" >//this article does not <span style= "font-family:arial, Helvetica, Sans-serif;" >username, password for verification, please add this part of the reader, such as to determine whether it is empty </span>
public class Httputils {private static final String tag= "httputils"; static string Pathstring=null;public httputils () {//T ODO auto-generated Constructor stub};p ublic static void Sendpost (String username,string password) {log.d (TAG, username); LOG.D (TAG, password);
                Get request <span style= "font-family:arial, Helvetica, Sans-serif;" >192.168.0.179:8080 the address for Tomcat, everyone is different, remember to modify </span>
<span style= "font-family:arial, Helvetica, Sans-serif;" >                               //The entire get URI </span><span style= "font-family:arial, Helvetica, Sans-serif;" >192.168.0.179:8080</span><span style= "font-family:arial, Helvetica, Sans-serif;" >?</span><span style= "font-family:arial, Helvetica, Sans-serif;" >username=admin&password=123</span><span style= "font-family:arial, Helvetica, Sans-serif;" ></span><span style= "font-family:arial, Helvetica, Sans-serif;" ></span>pathstring= "Http://192.168.0.179:8080/Myweb/Webdo" + "?" + "Username=" +username+ "&" + "password=" +password; LOG.D (TAG, pathstring);
Create Httpclienthttpclient client=new defaulthttpclient ();        Create GET request HttpGet get=new HttpGet (pathstring); try {
HttpResponse Response=client.execute (GET);
                        Gets the returned result 200 for the request to succeed. if (Response.getstatusline (). Getstatuscode () ==200) {log.d (TAG, "sucess!!");}} catch (Clientprotocolexception e) {//Todo auto-generated catch Blocke.printstacktrace ();} catch (IOException e) {//TODO Auto-generated catch Blocke.printstacktrace ();}};}


Login Interface Andriod Simple HTTP GET request (with server side) two

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.