• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

return directory's file list using String restTemplate

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Spring `RestTemplate` for the first time. Is there an easy way to get the list of filenames contained in a directory using Spring `RestTemplate` ? Is RestTemplate appropriate to the goal ?

TO get a specific file (filename), I would do sth like




But this time I simply would want the list of filenames contained in the directory url "https://myrepo.com/" . Which of the methods in the `RestTemplate` API woudld allow me to do so ?
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its not ftp its HTTP. Unless you have a rest endpoint available on your repo that will return the listing you are out of luck. If you can make a simple HTTP GET in your browser and see the listing then the same will work with the Rest Template but most likely that result will be HTML where the Rest Template is generally used with XML or JSON payloads. You could treat the HTML as a string and parse what you want out I suppose but that is a bit Kludgy.

Cross posted here:
http://stackoverflow.com/questions/26246176/get-filenames-list-using-spring-resttemplate
 
Grace Green
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, an HTTP GET on the browser shows the content of the directory.
I guess RestTemplate is not appropriate, as you say. I will have to find a different solution.

 
Grace Green
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, RestTemplate works for my purposes, well I do have to extract the list of filenames, but it gets the page no problem this way


 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats exactly what I said above when I said:

"""
the same will work with the Rest Template but most likely that result will be HTML where the Rest Template is generally used with XML or JSON payloads. You could treat the HTML as a string and parse what you want out I suppose but that is a bit Kludgy.

"""
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic