The code is working fine for the links that I got from internet, Hi Kostya Vasilyev ,
The problem is same even with DefaultHttpClient. On Nov 11, 10:16 am, Android Humanoid <droid.hu...@gmail.com> wrote: > Hi Bob Kerns, > > I'm not using any browser dependent code in my application, I'm just > sending the request from the business logic. > > Hi catalin Braica, > > The length of the content that am getting is -1, The server is ours > only, so I asked the server persons to look into the logs what exactly > logged, They informed that > there is nothing logged, Is there any chance for android to change > url, because, the same url is working on desktop. > On Nov 10, 3:29 pm, Catalin Braica <catalin.bra...@gmail.com> wrote: > > > Hello > > > Shouldn't you be testing for the HTTP status code ? Just a quick example: > > you can get zero-byte content in case of a redirect from the part of the > > server (3xx status code). In this case I see there is a flag to > > automatically follow redirects (HTTPUrlConnection.instanceFollowRedirects), > > but I don't see that you set it. > > But in all cases you need to test the HTTP status code. > > > Just my 2 cents > > > On Wed, Nov 10, 2010 at 5:46 AM, Android Humanoid > > <droid.hu...@gmail.com>wrote: > > > > No... nothing in logcat, download competed in 0sec am getting, but > > > there is nothing in thefile. > > > > On Nov 9, 2:21 pm, Kumar Bibek <coomar....@gmail.com> wrote: > > > > What is theproblem? Any exceptions/errors in our logcat? > > > > > On Tue, Nov 9, 2010 at 2:33 PM, Android Humanoid <droid.hu...@gmail.com > > > >wrote: > > > > > > Hi All, > > > > > > The following is the code that am using to download afilefrom the > > > > > web server on android mobile, > > > > > > imageURL="http://rokon.googlecode.com/files/rokon_src_2-0-3.zip"; > > > > > > try { > > > > > URL url = new URL(imageURL); //you can write here any > > > > > link > > > > > > Filefile= newFile(fileName); > > > > > > long startTime = System.currentTimeMillis(); > > > > > Log.i("DownloadManager", "download begining"); > > > > > Log.i("DownloadManager", "download url:" + url); > > > > > Log.i("DownloadManager", "downloadedfilename:" + > > > > > fileName); > > > > > > /* Open a connection to that URL. */ > > > > > > URLConnection ucon = url.openConnection(); > > > > > > /* > > > > > * Define InputStreams to read from the URLConnection. > > > > > * > > > > > */ > > > > > > InputStream is = ucon.getInputStream(); > > > > > BufferedInputStream bis = new BufferedInputStream(is); > > > > > > /* > > > > > * Read bytes to the Buffer until there is nothing > > > > > more to read(-1). > > > > > */ > > > > > > ByteArrayBuffer baf = new ByteArrayBuffer(50); > > > > > int current = 0; > > > > > while ((current = bis.read()) != -1) { > > > > > baf.append((byte) current); > > > > > } > > > > > > /* Convert the Bytes read to a String. */ > > > > > > FileOutputStream fos = new FileOutputStream(PATH > > > > > +file); > > > > > fos.write(baf.toByteArray()); > > > > > fos.close(); > > > > > Log.i("DownloadManager", "download ready in" + > > > > > ((System.currentTimeMillis() - startTime) / 1000)+ " sec"); > > > > > > } > > > > > catch (IOException e) { > > > > > Log.e("DownloadManager", "IOException: " + e); > > > > > } > > > > > catch(Exception ex) > > > > > { > > > > > Log.e("DownloadManager", "Exception: " + ex); > > > > > } > > > > > > this code is working fine for the above imageURL string, but when i > > > > > replace the url with the web server that am accessing then it is > > > > > givingproblem. can anyone help me in this.. > > > > > > Thanks&Regards. > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > > > Groups "Android Developers" group. > > > > > To post to this group, send email to > > > android-developers@googlegroups.com > > > > > To unsubscribe from this group, send email to > > > > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > > <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com> > > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/android-developers?hl=en > > > > > -- > > > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en