Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 29, 2015
1 parent 0fdee97 commit 95da712
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
public class DataManage {
//when connect to server
static String server = "115.65.57.253:8080";
static String serverPath = "firstTom/servlet/hello";
//static String server = "115.65.57.253:8080";
static String server = "192.168.11.3:9898";
//use these ward when connect to server
static String httpDemand = "Demand";
static String httpSignUp = "SignUp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
Expand All @@ -30,6 +29,7 @@ public class HttpCommunication {
//Post parameters
List<NameValuePair> postParams = new ArrayList<NameValuePair>();


public HttpCommunication(String serverName, String path){
//Uri for get
mBuilder = new Uri.Builder();
Expand Down Expand Up @@ -71,7 +71,8 @@ public void setPostParameter(String key1, String key2){
}

//try to do get
public void Get(){
public String Get(){
String str = "";
new Thread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -100,6 +101,7 @@ public String handleResponse(HttpResponse httpResponse) throws ClientProtocolExc
}finally {
httpClient.getConnectionManager().shutdown();
}

}
}).start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ public void onClick(View v) {
switch (v.getId()){
//when sing in button was pushed
case R.id.doSignIn:
//get server info
String server = DataManage.server;
String path = "/login";
//get ID and password
String strID = idSignIn.getText().toString();
String strPass = passwordSignIn.getText().toString();
//make password complex
strPass = encodePassdigiest(strPass);
Log.d("Intent","push button");
HttpCommunication hc = new HttpCommunication(server, path);
hc.setPostParameter("Id", strID);
hc.setPostParameter("Password", strPass);

//if the password and ID was collect, go to Home activity
intent.setClassName(packageName, packageName + ".Home");
startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void onClick(View v) {
case R.id.doSignUp:
//get server info
String server = DataManage.server;
String path = DataManage.serverPath;
String path = "/";
//get editor info
String sEmail = email.getText().toString();
String sPassword = password1.getText().toString();
Expand Down

0 comments on commit 95da712

Please sign in to comment.