Results 1 to 7 of 7
  1. #1
    lambi is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default Apache / Tomcat and a separate JavaSE program

    Note: i have no experience with Apache/Tomcat whatsoever, so it please bear with me if i just missed the answer in the tomcat documentation.

    So... I've got a rather big system, coded in Java SE, all working fine (at least everything i want to work). Now, i want it to be useable wirelessly (WLAN) via a webinterface. After some experimentation coding my own little webserver as an extra class within the system, i realized that's not a good way to go (too many problems with WLAN dropping stuff, different browsers using different encoding for the headers and so on). So i figured, why not use a already working webserver with a little added JSP that will handle the POST-stuff the client browsers will send. That JSP then should get the arguments from those POSTs and transfer them to my bigger program (both running on the same machine btw).
    So, before i start coding, what i basically would like to know is: Is it even possible in the way i just described? And, if so, how would i go about getting the stuff from the POSTs from the Tomcat to my own program (like i said, i know next to nothing about Apache/Tomcat)?

    Thanks in advance...

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,044
    Rep Power
    20

    Default

    JSPs shouldn't be doing the processing (or transferring).
    Instead you probably want a servlet as the end point for your URL, which will then call code in your app. Since you have a functioning app, why don't you simply stick a servlet as the entry point into it?

    I'd stick a link to the Sun tutorials here, but I haven't got them handy.

  3. #3
    lambi is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    thanks; like i said, i don't have much experience with tomcat / servlets / JSPs; so i wasn't sure how to establish a connection between those and my app.

    Since you have a functioning app, why don't you simply stick a servlet as the entry point into it?
    Well, at the time i get the requests from the clients, the app itself is already running; so i somehow have to get whatever arguments the clients sent to the server/servlet from the servlet over to the (already running) app.

  4. #4
    lambi is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    after spending some time and thought on this: would it be possible to transfer simple strings from the servlet to the application using the clipboard functions from the awt.datatransfer-package (Java 2 Platform SE v1.3.1: Package java.awt.datatransfer)?

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,044
    Rep Power
    20

    Default

    Well, what's your standalone program expecting?
    I assume you have it listening for some event, or watching a directory for a file, or something?

  6. #6
    lambi is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    Basically, the servlet has to transfer a string to the standalone app every time it receives a POST from a client, transferring the argument from the POST to the standalone app. The app should then further process the argument.
    Since the argument itself is a simple string, i figured i could let the servlet paste the string into the clipboard and then use the lostOwnership() method provided by the awt to retrieve the contents of the clipboard every time those get changed.

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,044
    Rep Power
    20

    Default

    This really isn't normal at all.
    If you have to change your standalone program then why not simply change it such that it is now part of the webapp?

    I suspect it would end up being far more scaleable that way as well.

Similar Threads

  1. Apache-tomcat
    By rakesh1983 in forum NetBeans
    Replies: 1
    Last Post: 09-28-2009, 07:44 AM
  2. What d u use, Apache Tomcat or GlassFish? Why
    By thom_ in forum New To Java
    Replies: 0
    Last Post: 03-05-2009, 11:14 PM
  3. Apache Tomcat 6.0.16
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-29-2008, 04:22 PM
  4. Replies: 1
    Last Post: 08-07-2007, 05:26 AM
  5. Tomcat and apache
    By Daniel in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-06-2007, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •