Hello everybody!

I have the following problem...

I have  two servlets called "Servlet1" and "Servlet2". "Servlet1" is in my
web site (so I know its structure and its code) while Servlet2 belongs to
another external web-site (not mine! So I don't know anything about its
srtucture).

Servlet2  belongs to a company, called "Company2", that produces a special
service (for example it provides the  access to special databases) while
Servlet1 to my company, called "Company1", that must distribute Company2's
service to the Web Users (they are clients of Company1). So the Web Users
has a money account with Company1 that they can use to pay the services they
can get from Company2 (Comapany2 is paid from Comapany1 not directly from
Web Users).

Every time Servlet 2 receives a request it returns a special HTML result
page that contains a special string embedded in the html code of the
document in comment format. The string has been put in the result html page
returned by Servlet 2 to let the distributors of Company2's services to
acquire useful information on the result of the operation requested. For
example the string could have such structure:

..  (Here there is html code)

<!-- Field1 | Field2|....|Field n -->   (this is the "result string" present
in the Web Page that I want to get and parse)

. (Other HTML code)

"Field1" could contain the type of the operation executed, "Field2" the
result of the operation (success or not), "Field3" the reason of a possibile
failure of the operation, "Field4" the cost of the operation  and so on...

This string is very useful for Company1 to manage the money account of their
clients that have requested Company2's operations....

This means that the Web User Interface (that is to say the Web pages) for
the people who want access to the Company2's services (and so for Company1's
clients)  is determined by Servlet2. Servlet 1 must only:

1)To read the result string for every request sent to Servlet 2.
2)To parse the result string and get all the information it needs to manage
the money account of Company1's users.
3)To compute the data it got from the result string and update Company1's
databases (to decrease for example the money account of the users).


Anyway there is a problem..... the result Web Page must be read from
Servlet1 to get the result string: this means that the request must be sent
from Servlet 1 to Servlet 2 and not directly from the Web Users (Comapny1's
clients) surfing in Company2's web site. So I think all that I have to do in
my web site (Company1's web site) is:


1) When a client "A" of Company1 wants to use Company2's services from
Company1's web site, his request must be forwarded to Servlet 1;
2) Servlet1 sends the request of A to Servlet 2.
3) Servlet 1 receives the result HTML page (called "RP") from Servlet2;
4) Servlet 1 reads and parses the result string (called "RS") present in RP;
5) Servlet 1 get the data from RS and use them to update Comapany1's
databases.
6) Servlet 1 shows RP to the client A.


I think that the first point can be implemented only setting correctly the
web server to redirects the request sent to servlet2's url to servlet1's
url. Am I right?

Can someone suggest to me some short code example to implements the other
points please? In fact I don't know for example how to send the client's
request  directly from servlet1 to servlet2. In fact servlet1 should read
the entire data stream redirected from the Web Server and forwarded it to
servlet2.
Then...how can I read the entire data flow of the result returned by
servlet2 to servlet1 to get the result string (RS)?? And at last....how to
show the RP to client A?


I hope someone can help me...thanks a lot everybody in advance for both help
and patience!!

Regards,

                   Luca










 What I would like to do is to send requests to Servlet put a link
When

before sending the requests (so the HTML forms too) from the Web Page to
Servlet2  they must be filtered from Servlet 1 (that must add some other
data to them): so I would like to configure my Web browser so that when a
request from "MyPage" is sent to Servlet2's url:

http://mydomain/servlet2

it is redirected to Servlet1's url:

http://mydomain/servlet1


How can I configure my Web Brower in such way? I want to point out that I
have Tomcat 4 as Web Browser ....

When Servlet1 receives the data flow of the request it adds some other data
to it and then
redirect it to Servlet2. Which code must I include int he POST method of
Servlet 1 so that:

1)Servlet1 reads the data flow that has been sent to it. Note that Servlet 1
doesn't know which

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to