Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

forward response from one servlet to another via proxy  RSS feed

 
mi go
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Two servlets Account and Billing. Account sending string in GET req to Billing and Billing capitalizing the String and sending back via REsponse. Now I want to insert proxy in between whihc is called Billing only so communication is like
Account--->Billing(Proxy)--->Billing  and response should be Billing--->Billing(proxy)...>Account.  Following is code for all servlets

Account.java



Billing.java THIS IS PROXY


Actual BILLING.java

I am receiving output as follows:
200 response from target proxy to Account
Account servlet sending data :abc

capitalizedStringFromBilling in account as response
THIS IS HELLO FROM PROXY FOR WebApp2
200 response from Billing to proxy
ABC
ABC

that means i am not able to forward responce from actual Billing to Account via proxy as nothing is printed after "capitalizedStringFromBilling in account as response"

whats wrong?



 
Dave Tolls
Ranch Hand
Posts: 2721
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that output is what you see from a call to Account, then that's correct isn't it?

This output is prior to reading the response from the proxy (in Account):

200 response from target proxy to Account
Account servlet sending data :abc


This output is the String literal on line 41 of Account:

capitalizedStringFromBilling in account as response

The rest has come over from the proxy, which is broken down into:

THIS IS HELLO FROM PROXY FOR WebApp2
200 response from Billing to proxy


then:

ABC

which is the out.println call on line 40 of the proxy and:

ABC

which is the out1.println call in the proxy.  Though why you get the writer a second time I don't know.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!