• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

forward response from one servlet to another via proxy  RSS feed

 
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?



 
Rancher
Posts: 3596
39
  • 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!