2012-09-14 9 views
7

Kimlik doğrulama bilgileri burada ayarlanmıştır, kullanıcı/parola doğruysa her şey mükemmel çalışır, ancak hatalıysa askıda kalıyor. Bu, yanlış kimlik bilgileri bu hat üzerinde asılı, hemen burada asılı .:Yanlış giriş kimlik bilgileri sağlandığı taktirde httpsURLConnection.getInputStream() işlevi Android'de nasıl saklanır?

Authenticator.setDefault(new Authenticator() { 
     protected PasswordAuthentication getPasswordAuthentication() { 
      return new PasswordAuthentication(user, password.toCharArray()); 
     } 
    }); 

Code 401 dönmek sunucu sorunları, ben Curl ve Browser ile işaretli değil: = new BufferedReader (Yeni InputStreamReader (httpURLConn. getInputStream()));

try { 
     URL url = new URL(resourceUrl); 
     HttpURLConnection httpURLConn = (HttpURLConnection) url.openConnection(); 
     String rawData = ""; 
     String currentLine = null; 
     BufferedReader in = null; 

     in = new BufferedReader(new InputStreamReader(httpURLConn.getInputStream())); 
     while ((currentLine = in.readLine()) != null) { 
      rawData = rawData.concat(currentLine); 
     } 
     in.close(); 
    } catch (UnknownHostException e) { 
     Log.i(CLASS_NAME + "::" + METHOD_NAME 
       , "An exception occured while reading data from remote host. httpURLConn.responseCode = " + httpURLConn.getResponseCode() 
       + "/httpURLConn.responseMessage = " + httpURLConn.getResponseMessage(), e); 
     throw new UnknownHostException(); 
    } catch (IOException e) { 
     Log.i(CLASS_NAME + "::" + METHOD_NAME 
       , "An exception occured while reading data from remote host. httpURLConn.responseCode = " + httpURLConn.getResponseCode() 
       + "/httpURLConn.responseMessage = " + httpURLConn.getResponseMessage(), e); 
     throw new IOException(); 
    } 

cevap

0

sunucu bağlantısı canlı (-Yaşatmak başlığı) tutuyor olabilir misin (İstisna yok, sadece bu hat üzerinde kalır)?

+0

Hayır, yanıtta Keep-Alive başlığı yok –

İlgili konular