Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:17:44+00:00 2026-06-17T12:17:44+00:00

I have two clients (A and B) and Servlet. I want, when A client

  • 0

I have two clients (A and B) and Servlet. I want, when A client send a request to the SERVLET, SERVLET redirected the request to the client B and client B send response back to the client A. CLIENT ARE NOT SERVLETS!!! They are ordinary socket clients, consequently IS NOT possible classic servlet redirect!!

Do you have any suggestions for troubleshooting???

Thanks a lot!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:17:45+00:00Added an answer on June 17, 2026 at 12:17 pm

    Firstly, you can’t serialize a HttpServletRequest or HttpServletResponse using Java serialization. Objects that conform to these APIs typically include references to “stuff” in the servlet implementation stack that is inherently non-serializable.

    Second, you can’t “redirect” a request to another client. It doesn’t make sense from the perspective of the HTTP protocol.

    • A redirect happens when a client sends a request to a server and the server response has a 3xx status code that says “try that request somewhere else”. It is a redirection to a different server, not a different client.

    • Even ignoring the details of what redirection means. You can’t send an HTTP request to something that is in the HTTP client role. It won’t be expecting it (listening for it), and wouldn’t know what to do with it. (And indeed it would be a violation of the HTTP protocol.)

    Thirdly, an “ordinary socket client” can’t talk to an HTTP service (implemented using Servlets, or anything else). The client has to implement at least a subset of HTTP protocol in order to make itself understood by the HTTP service. It is possible to implement that “by hand”, but IMO that’s a bad idea … when there are high quality implementations you can use for free.

    In short, what you seem to be trying to do is impossible / nonsensical. (If I understand your Question correctly … which is debatable.)


    If you explained what you were actually trying to do here, we might be able to suggest sensible alternative approaches.


    I’m trying to connect two java client applications across server. The client will be able to communicate directly with other client.

    Literally you can’t do that using HTTP. But you could build an HTTP server/servlet that transfers messages from one client to another; e.g.

    1. Client A sends a PUT request containing a message for A to server.
    2. Server stores message and replies to client A.
    3. Client B sends a GET request asking “any messages?” to server.
    4. Server looks up messages and responds with the message from A.

    But note that you can’t do that with plain socket clients. The clients have to be HTTP clients.

    If you were prepared to ditch the requirement that the server was an HTTP server / servlet, you could have “simple socket” clients open duplex connections to the server, and have the server pass “messages” between the clients. This entails implementing a custom “protocol” for messaging.

    A third alternative is to use an existing RPC or object broker technology; e.g. RMI, CORBA, ICE, etcetera

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files client.php and server.php. The client file send a HTTP request
I have two servlets. 1 serves as a primary server for my applet clients
I have two perforce clients (client-a, client-b) that each contain about 40 file specs.
I have two servlet: first servlet is similar to a client and creates an
If I have an international website and I have two clients: client from Spain.
I have two models Clients and Reports. A Client has_many Reports and a Report
I currently have two clients (Producer/Consumer), and I am trying to send a large
If I have two clients which are aware of each other (ie, they know
So assume you have two clients, C1 and C2, each client has a GUID
I have two WCF clients consuming a 3rd party web service. These two clients

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.