Results 1 to 4 of 4
  1. #1
    varadha is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default How to create file into another host from a host

    Hi,


    I want to create a file "file1.txt" which holds the input from host1.

    I have to upload this file in another host (host2).

    I could connect to host2 location using http. The location is
    http://host2/file/

    Kindly let me know if there exists a solution.


    Thank You.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    Kindly let me know if there exists a solution.
    Yes, there exists a solution to do this.

  3. #3
    varadha is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default File creation in one host from another host

    Can you please explain the approach to achieve this

  4. #4
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    well, the problem is not clearly stated, so ill try based on some assumptions.
    I assume that server1 is a web server and it has received data from a user that filled in a form on a screen in an application in server1 and for what ever reason we want to get this data to server 2.

    You said upload, so I assume you don't have direct database or file system access, such as it is to an external site and the only aproach is HTTP.

    So in this case, I would probably use a http client library such as the commons-httpclient from a servlet inside my server1 application to do a HTTP post to the server2.

    where server2 would run a servlet mapped to a url that i expect to be secured and only invocabley by server1, perhaps http authentication. and i would have the servlet receive the post body, which in this case is the file content, and write it out to the server 2 file system, or what ever it is that it should do with it.

    though this sounds a lot like what would be readily possible to do with web services, such as a SOAP message, which would probably use axis2 library, or JSON message which I would use my own json.org based parser in my receiver servlet. and possibly not even use a file, but the form data contents as the message body.

    but either of the HTTP based messaging approaches is well suited for use where the sender is a web server (server1), or a human running a command line application with the commons-httpclient or axis2 libraries built into it, to connect to the server2

    hope that helps

Similar Threads

  1. copy file from local host to remote host
    By isotoper in forum New To Java
    Replies: 4
    Last Post: 12-24-2009, 04:41 PM
  2. Host Blacklisted
    By neeti in forum Networking
    Replies: 6
    Last Post: 10-27-2009, 10:31 AM
  3. Replies: 0
    Last Post: 10-31-2008, 07:07 PM
  4. Looking Up the Address of a Host
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:11 PM
  5. Getting the host of the applet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-10-2008, 02:56 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
  •