Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/07/2013, 20:46
Alemanarg
 
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires, Mar del plata
Mensajes: 250
Antigüedad: 15 años, 10 meses
Puntos: 2
Descargar archivo con password

Hola!

Tengo una consulta rápida que quizá me puedan ayudar.
Estoy probando descargar un archivo desde la web que tiene una contraseña.
Sin la misma, mi codigo anda.
La pregunta es...como agregarle a la validación del URLConnection cuando el archivo a bajar tiene contraseña? Me sirve el getAuthority()?

Parte del código es este:

Código ANDROID:
Ver original
  1. .....
  2.  
  3. try {
  4. URL url = new URL(f_url[0]);
  5.                    
  6. URLConnection conection = url.openConnection();
  7. conection.connect();
  8.  
  9. // this will be useful so that you can show a tipical 0-100% progress bar
  10.  int lenghtOfFile = conection.getContentLength();
  11.      
  12. // download the file
  13. InputStream input = new BufferedInputStream(url.openStream(), 12000/*8192*/);
  14.      
  15.  // Output stream
  16. String nombre_arch = "/....."+xxxxxx;
  17. OutputStream output = new FileOutputStream(nombre_arch);
  18.      
  19. byte data[] = new byte[1024];
  20.      
  21. ....

Gracias!!