?
Solved

Redirecting client browser to another server

Posted on 2003-03-03
10
Medium Priority
?
218 Views
Last Modified: 2010-03-31
Hello All!!

I have a scenario... When a client browser requests for a web page from my System, I must redirect the request to another Webserver running on a second PC.

For this I first coded a program that can get the client browser's header. I then sent this header to the Webserver running on the Second system. I then got the response(Webserver's HEader) from the second system and then I send it to the client's browser. After this process the webserver will actually start sending the files in 1K bytes. I am now having a problem in sending these bytes to the client system...

Any new ideas or ideas to implement will be much appriciated

Thank You

Shiva
0
Comment
Question by:shivasrini
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 92

Accepted Solution

by:
objects earned 272 total points
ID: 8062391
What don't you simply send a redirect?
0
 
LVL 2

Assisted Solution

by:functionpointer
functionpointer earned 264 total points
ID: 8062398
do you mean you are trying to proxy a chunked response? If so, you will have to either buffer it ( difficult ), or read the whole resonse from the server, put together and send it to the client in one piece.
0
 
LVL 4

Expert Comment

by:antons061400
ID: 8062544
If the client can access the second server directly you can return page like:

<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="1;URL=http://secondserver/.html">
</HEAD>
<BODY>
The page will be redirected in  one second.
</BODY>
</HTML>
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 92

Expert Comment

by:objects
ID: 8062584
I already suggested sending a redirect.
0
 

Author Comment

by:shivasrini
ID: 8063506
Thanks for your response..

Actually it is not the problem of transfering web pages. Actually this is a netowrking project, where by I need to redirect the client that is accessing, to the second sever.

Finally the client must not know where his webpage is coming from.

Thanks
Shiva
0
 
LVL 1

Assisted Solution

by:tutran
tutran earned 264 total points
ID: 8066214
I guess what you're trying to do is to have webserver1 act like a broker, relaying message from webserver2 to the client without them knowing.

To simulate client's request header you want to get headers from request object, simulate user's request by setting headers connection properties using these headers.  Make sure that you have the standard header such as User-Agent, Content-Type, etc.  Let me know if further question:

conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

conn.setRequestProperty("User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0");

conn.setRequestProperty("Content-length", "" + text.length);      


Enumeration headers = req.getHeaderNames();
while (headers.hasMoreElements()) {
        String aHeaderName = (String) headers.nextElement();
        String aHeaderValue = (String) req.getHeader(aHeaderName);

        conn.setRequestProperty(aHeaderName, aHeaderValue);
}
0
 
LVL 2

Expert Comment

by:functionpointer
ID: 8069316
I assumed from your original question that you were receiving the data from the webserver in chunks, and that's what was giving you the problem proxying the response. Is this the case?
0
 

Expert Comment

by:CleanupPing
ID: 9058949
shivasrini:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9762116
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between objects, functionpointer and tutran

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TimYates
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question