• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Desktop application accessing HTTP access and handling cookie information?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

This question may seem rather unusual for many experienced Java programmers, and I am not sure which forum this question fits best.
We have a custom-made CMS(content management system) which is based on PHP/MySQL and its front end is built with HTML/JavaScript. The CMS handles a lot of file-uploading and downloading between our web server and the remote clients.

We are a little frustrated for the limitation the html's ability in handling file uploads. To put it simply, it's too basic for us who want to do something more complicated. So, my manager was wondering how about building a Java desktop application/Java Web Start app and has it run on remote client? We want to discard the html/Javascript front end of the CMS and have the Java desktop app to act like a browser so that the app makes HTTP requests to the web server.

We've managed to write something that can send a POST request using a URL, but we are not too sure how to handle http headers and cookies for authentication purposes.

Are there any codes or simple tutorial we can take a look at? Advices on other things related to the above case/workaround would be appreciated too. Thank you very much for help.
 
Sheriff
Posts: 28327
96
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have used Apache HttpClient for that sort of thing in the past. I'm pretty sure it handles all of those issues.
 
S Chan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:I have used Apache HttpClient for that sort of thing in the past. I'm pretty sure it handles all of those issues.



Haven't heard of that before! :shock: :eek:

That's helpful. I will take a look on that. :thumbup: Thank you!
 
Ranch Hand
Posts: 300
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thumbs up to Paul and Thanks to Apache, Apache has made really fantastic library on top of Java no matter what is the requirement there is a Apache library
 
S Chan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please allow me to extend the question a bit:

How about displaying HTMLs? If, say, I want have some sort of previewing mechanism that displays HTML and CSS, as well as running JavaScript.

I know Swing components do support some HTML tags, but I don't think they are powerful enough to display web pages as good as ordinary web browsers.

Is there a good library to use for this purpose this time?

P.S. I have heard of Selenium as a HTML test suite. That is able to start up a Firefox window from Java, but I was thinking if there is a way to display the HTML inside a Swing app?
 
Are you here to take over the surface world? Because this tiny ad will stop you!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic