HTTP tunneling and Servlet communication

Discussion in 'Java' started by exquisitus, May 20, 2005.

  1. exquisitus

    exquisitus Guest

    I am developing a J2EE app, front end is a fat client accross the
    internet. Until recently, I was planning to use RMI to communicate
    between f/end and server but after lots more reading I have decided
    against it (for reasons which would be obvious to anyone attempting to
    reply this post - so to keep the post brief, I'll skip enumerating them
    here).

    I want to use a servlet layer at the backend, because my client will
    almost definitely be behind a firewall/using a proxy server (I will
    therefore need http/s tunneling to communicate with clients). I have
    come up with a class which acts as a Facade to clients and presents a
    course simpler request/response API to clients. I have a Requset Factory
    which creates Asynch and Synch Requests. I am however stuck now and need
    some help. I am not sure how to convert my method call into an HTTP
    request (I have read several Servlet tutorials but still can't see a
    usefule xample that shows how a thick client can use a servlet - all
    examples seem to be about web browsers).

    Additionaly, I have not entirely worked out how I can "force" certain
    requests (i.e. SynchRequests) to be blocking. I have some ideas, but
    there are all pretty much hacks. i would be grateful for any ideas or
    pointers here.

    Lastly, whilst all this request/response is going on, I want to be
    "pushing" data from the server to the client through the same tunnel. Is
    this possible?. Can I send request/responses AND data on the same tunnel
    (presumably the same port)?.

    Tks
    exquisitus, May 20, 2005
    #1
    1. Advertising

  2. i am not sure i completely understand ur design ...
    but I use Httpclient in a java thick client to communicate with a
    servlet or any http servers ... basically mimic a browser... (
    apache.commons.httpclient )

    -v


    exquisitus wrote:
    > I am developing a J2EE app, front end is a fat client accross the
    > internet. Until recently, I was planning to use RMI to communicate
    > between f/end and server but after lots more reading I have decided
    > against it (for reasons which would be obvious to anyone attempting

    to
    > reply this post - so to keep the post brief, I'll skip enumerating

    them
    > here).
    >
    > I want to use a servlet layer at the backend, because my client will
    > almost definitely be behind a firewall/using a proxy server (I will
    > therefore need http/s tunneling to communicate with clients). I have
    > come up with a class which acts as a Facade to clients and presents a


    > course simpler request/response API to clients. I have a Requset

    Factory
    > which creates Asynch and Synch Requests. I am however stuck now and

    need
    > some help. I am not sure how to convert my method call into an HTTP
    > request (I have read several Servlet tutorials but still can't see a
    > usefule xample that shows how a thick client can use a servlet - all
    > examples seem to be about web browsers).
    >
    > Additionaly, I have not entirely worked out how I can "force" certain


    > requests (i.e. SynchRequests) to be blocking. I have some ideas, but
    > there are all pretty much hacks. i would be grateful for any ideas or


    > pointers here.
    >
    > Lastly, whilst all this request/response is going on, I want to be
    > "pushing" data from the server to the client through the same tunnel.

    Is
    > this possible?. Can I send request/responses AND data on the same

    tunnel
    > (presumably the same port)?.
    >
    > Tks
    Arjunan Venkatesh, May 20, 2005
    #2
    1. Advertising

  3. exquisitus wrote:

    > I want to use a servlet layer at the backend, because my client will
    > almost definitely be behind a firewall/using a proxy server (I will
    > therefore need http/s tunneling to communicate with clients). I have
    > come up with a class which acts as a Facade to clients and presents a
    > course simpler request/response API to clients. I have a Requset Factory
    > which creates Asynch and Synch Requests. I am however stuck now and need
    > some help. I am not sure how to convert my method call into an HTTP
    > request (I have read several Servlet tutorials but still can't see a
    > usefule xample that shows how a thick client can use a servlet - all
    > examples seem to be about web browsers).


    did you look at SOAP?

    >
    > Additionaly, I have not entirely worked out how I can "force" certain
    > requests (i.e. SynchRequests) to be blocking. I have some ideas, but
    > there are all pretty much hacks. i would be grateful for any ideas or
    > pointers here.


    well, http is actually synchronous, so your problem should be to do that
    non blocking

    >
    > Lastly, whilst all this request/response is going on, I want to be
    > "pushing" data from the server to the client through the same tunnel. Is
    > this possible?. Can I send request/responses AND data on the same tunnel
    > (presumably the same port)?.


    I don't know if this is possible. The problem here is basically to get
    more http responses for one request, which is fairly hard. The only
    possibility I can think of is to send responses with the 100 status
    code. As far as I know, in that case it's possible to send more responses.
    Andrea Desole, May 20, 2005
    #3
  4. exquisitus

    exquisitus Guest

    Andrea Desole wrote:

    >
    >
    > exquisitus wrote:
    >
    >> I want to use a servlet layer at the backend, because my client will
    >> almost definitely be behind a firewall/using a proxy server (I will
    >> therefore need http/s tunneling to communicate with clients). I have
    >> come up with a class which acts as a Facade to clients and presents a
    >> course simpler request/response API to clients. I have a Requset
    >> Factory which creates Asynch and Synch Requests. I am however stuck
    >> now and need some help. I am not sure how to convert my method call
    >> into an HTTP request (I have read several Servlet tutorials but still
    >> can't see a usefule xample that shows how a thick client can use a
    >> servlet - all examples seem to be about web browsers).

    >
    >
    > did you look at SOAP?


    Yeah. Sorry, I should have mentioned that I did not want to use SOAP
    because of all the "weight" of the XML payload and also the extra XML
    procesing required on both ends. I want this to be as lightweight as I
    can get away with (securely).

    >
    >>
    >> Additionaly, I have not entirely worked out how I can "force" certain
    >> requests (i.e. SynchRequests) to be blocking. I have some ideas, but
    >> there are all pretty much hacks. i would be grateful for any ideas or
    >> pointers here.

    >
    >
    > well, http is actually synchronous, so your problem should be to do that
    > non blocking


    My bad. I should have read what I was typing before I sent the post ;-).
    You are entirely right - the problem is to make the calls asynch. I have
    ideas about how to do it - an obvious one would be spawning a new thread
    which actually executes the HTTPRequest command, returning to the user
    and then calling back the callee when the data arrives/times out etc,
    but I wanted to know if there is another (more elegant?) way.

    >
    >>
    >> Lastly, whilst all this request/response is going on, I want to be
    >> "pushing" data from the server to the client through the same tunnel.
    >> Is this possible?. Can I send request/responses AND data on the same
    >> tunnel (presumably the same port)?.

    >
    >
    > I don't know if this is possible. The problem here is basically to get
    > more http responses for one request, which is fairly hard. The only
    > possibility I can think of is to send responses with the 100 status
    > code. As far as I know, in that case it's possible to send more responses.


    No, that is not what I mean. I'm talking about a client sending a
    request and simultaneously receiving data that is being "pushed" from
    the server. The key here is that the data is being pushed or streamed
    from the server. It is a "push" model i.e. not the typical "pull" model.
    Again, of the top of my head - I think I could have the datastream
    listener running in another thread and then handling the streaming data
    as it arrives (maybe it is tagged differently?). Which also suggests the
    possible use of a buffer so that data dosen't get lost if the client is
    busy.....
    exquisitus, May 20, 2005
    #4
  5. exquisitus wrote:
    >
    > Yeah. Sorry, I should have mentioned that I did not want to use SOAP
    > because of all the "weight" of the XML payload and also the extra XML
    > procesing required on both ends. I want this to be as lightweight as I
    > can get away with (securely).


    well, than you will have to do something similar; a servlet that gets
    HTTP requests that contain, in the body, the paramters.

    >
    > My bad. I should have read what I was typing before I sent the post ;-).
    > You are entirely right - the problem is to make the calls asynch. I have
    > ideas about how to do it - an obvious one would be spawning a new thread
    > which actually executes the HTTPRequest command, returning to the user
    > and then calling back the callee when the data arrives/times out etc,
    > but I wanted to know if there is another (more elegant?) way.


    don't think so. This is the regular solution.

    >
    > No, that is not what I mean. I'm talking about a client sending a
    > request and simultaneously receiving data that is being "pushed" from
    > the server. The key here is that the data is being pushed or streamed
    > from the server. It is a "push" model i.e. not the typical "pull" model.


    I think I understood correctly. The problem is that you don't have push
    in HTTP. What I can imagine is that the client sends a first request to
    the server, and then the server sends multiple responses. This might
    simulate a push model.

    > Again, of the top of my head - I think I could have the datastream
    > listener running in another thread and then handling the streaming data
    > as it arrives (maybe it is tagged differently?). Which also suggests the
    > possible use of a buffer so that data dosen't get lost if the client is
    > busy.....
    >


    I'm not sure, but if you want to use streaming you should check how it
    works with a proxy.
    Andrea Desole, May 20, 2005
    #5
    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. bigbinc

    http tunneling, and soap.

    bigbinc, Dec 8, 2003, in forum: Java
    Replies:
    0
    Views:
    401
    bigbinc
    Dec 8, 2003
  2. Alex Molochnikov

    HTTP tunneling through proxy server

    Alex Molochnikov, May 9, 2004, in forum: Java
    Replies:
    7
    Views:
    3,727
    Marat
    May 28, 2004
  3. MattC
    Replies:
    11
    Views:
    4,607
    HalcyonWild
    Oct 14, 2005
  4. nono240

    J2ME : http tunneling client ?

    nono240, Feb 7, 2008, in forum: Java
    Replies:
    0
    Views:
    455
    nono240
    Feb 7, 2008
  5. chandan

    HTTP tunneling in aglets

    chandan, Jul 18, 2008, in forum: Java
    Replies:
    4
    Views:
    296
    Andrew Thompson
    Jul 18, 2008
Loading...

Share This Page