How to: call a Servlet within a java class

Discussion in 'Java' started by Marco, May 12, 2004.

  1. Marco

    Marco Guest

    Hi to all!

    I have an Apache Tomcat 5.0.19 Server installed on a machine in my network
    (ip address: 192.168.0.211, port 8080)

    I've a Servlet running on it. FileUploadServlet uses "FileUpload package" from
    Apache Jakarta Project (see: http://jakarta.apache.org/commons/fileupload/), in
    order to implement Upload services

    I'm able to call this Servlet from a jsp test page: FileUploadServletTest.jsp
    is on 192.168.0.211 and I can call it from any machine in my network, calling
    http://192.168.0.211:8080/UploadTest/FileUploadServletTest.jsp

    The Servlet works fine!

    Now: I want to call this Servlet from a java class. This class is called
    UploadStockFile.java and is part of a standalone Swing-based java program.
    This program is running on a machine in my network (ip: 192.168.0.112)

    How can I do this? How can I call this servlet from a java class?

    Any idea greatly appreciated

    Thanks and sorry for bad english ;)

    Bye

    Marco
     
    Marco, May 12, 2004
    #1
    1. Advertising

  2. Davor Cengija, May 12, 2004
    #2
    1. Advertising

  3. Marco

    Tony Morris Guest

    > How can I do this? How can I call this servlet from a java class?
    >
    > Any idea greatly appreciated
    >
    > Thanks and sorry for bad english ;)
    >
    > Bye
    >
    > Marco



    Have a look at java.net.URL.

    --
    Tony Morris
    (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    Software Engineer
    IBM Australia - Tivoli Security Software
    (2003 VTR1000F)
     
    Tony Morris, May 12, 2004
    #3
  4. Marco

    Chris Smith Guest

    Marco wrote:
    > How can I do this? How can I call this servlet from a java class?
    >


    Most likely, one of your other responses will be helpful. If not,
    please describe what you mean by "call". The phrase "call a servlet" is
    not a well-defined or commonly used phrase, so everyone is guessing at
    what you mean by it. You could be more specific about what you'd like
    to happen, and possibly get better answers.

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, May 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Clarke
    Replies:
    1
    Views:
    1,901
    Sudsy
    Jan 7, 2004
  2. circuit_breaker
    Replies:
    2
    Views:
    2,021
    Jack Jia
    Apr 4, 2004
  3. chamikara
    Replies:
    1
    Views:
    49,880
  4. HARI OM
    Replies:
    0
    Views:
    9,397
    HARI OM
    May 4, 2005
  5. ppcguy
    Replies:
    1
    Views:
    613
    Andrea Desole
    Aug 8, 2005
Loading...

Share This Page