Advertisement
Guest User

Untitled

a guest
May 28th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. if (debug) {
  2. Log.d("edoc","edoc ExtractedMethod 8");
  3. Log.d("edoc","edoc response.getStatusLine()**" + response.getStatusLine().getStatusCode());
  4. serverRespone = response.getStatusLine().getStatusCode();
  5. System.out.println(serverRespone);
  6. Log.d("edoc","edoc serverRespone**" + serverRespone);
  7. return serverRespone; //return int型態 server http code
  8. }
  9.  
  10.  
  11. class uploadFiles2eDoc extends AsyncTask<String, Void, String> {
  12. private Exception exception;
  13. @Override
  14. protected String doInBackground(String... strings) {
  15. Log.d("edoc","edoc AsyncTask");
  16. Conn conn_adv = new Conn(new Constants(getUserName, getPassWord, getIpAddress, 80));
  17. conn_adv.setUrl("/collab/my/"+conn_adv.getUser()+"/");
  18. Log.d("edoc","edoc upload JPG");
  19. if (file == null)
  20. {
  21. return "EXCEPTION";
  22. }
  23. try {
  24. // String putAvg = "PUT avg: ";
  25. ExtractedMethod exm = new ExtractedMethod();
  26. resultHTCode = exm.run(HTCode.Code.PUT, 1, conn_adv, true, file , 1000, true); //接收回傳值
  27. // resultCodeAuthentication(resultHTCode); //餵入resultCodeAuthentication function
  28. Log.d("edoc","edoc htcode"+resultHTCode);
  29. Log.d("edoc","edoc AsyncTask run");
  30. Log.d("edoc","edoc htcode"+resultHTCode);
  31. synchronized(conn_adv){
  32. conn_adv.notify();
  33. }
  34. } catch (Exception io) {
  35. io.printStackTrace();
  36. Log.d("edoc","/****************/"+io);
  37. }
  38. return "EXCEPTION";
  39. }
  40.  
  41. public void resultCodeAuthentication(int resultHTCode){
  42. int result = resultHTCode;
  43. Log.d("edoc","edoc resultCode switch "+result);
  44. if(result >= 200 && result <= 209 )
  45. {
  46. Log.d("edoc","edoc test ");
  47. Toast.makeText(MainActivity.this, "上傳成功", Toast.LENGTH_SHORT).show();
  48. Log.d("edoc","edoc test ");
  49.  
  50. }else if(result >= 400 && result <= 432){
  51. Toast.makeText(MainActivity.this, "使用者資訊錯誤", Toast.LENGTH_SHORT).show();
  52. }else{
  53. Toast.makeText(MainActivity.this, "其他", Toast.LENGTH_SHORT).show();
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement