tags:

views:

26

answers:

1

I have a (A) servlet listening for GETS from another Servlet (B).

B is using an HTTPClient to do gets back to A as follows.

get.setRequestHeader("name",job.getName().toString());
get.setRequestHeader("age",job.getAge());
get.setRequestHeader("sex",job.getSex());

Ordinarily I would have used the query string but I am not the dev on B so I need to fetch it from the requestHeader.

A is just a simple servlet I'm guessing the question is how do I perform the equivalantof the HTTPClients
getRequestHeaders(String headerName) in simple J2EE.

2 Questions:

a) Is this this best practice to send on the requestHeader ?

b) How do I pick these name value pairs up ?

Thanks

Imerez

+1  A: 

Genrally in a servlet you can get headers like this:

  request.getHeader(headerName));

You can get a complete list of allavailable headers as an enumeration like this:

  Enumeration headerNames = request.getHeaderNames();
Vincent Ramdhanie
for some reason i just didnt see the getHeader() method thanks Vincent
wmitchell