You need to wrap the request with a wrapper that overrides the getMethod()
method.  Something like:
 class GetWrapper extends HttpServletRequestWrapper {
      public GetWrapper(HttpServletRequest request) {
         super(request);
     }
     public String getMethod() {
         return "GET";
     }
 }

 GetWrapper wrapper = new GetWrapper(request);
 RequestDispatcher rd =
                     getServletContext().getRequestDispatcher(direct);
 rd.forward(wrapper, response);


"Paul Hsu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thank you for the help. I think you may misunderstand my question. My
> question is how can I forward the request to my next URL and change the
> method to 'GET' if the orignal request is using 'POST'.
> For example:
>
> test1.html call servlet1 by using "POST" method, but servlet1 need to
> forward to servlet2 by using "GET". How can I switch from "POST" to "GET"
in
> servlet1.
>
> thanks
>
> ----- Original Message -----
> From: "Jose Euclides da Silva Junior - DATAPREVRJ"
> <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
> Sent: Tuesday, May 27, 2003 3:26 PM
> Subject: RES: servlet question
>
>
> try doGet() instead of doPost().
> good luck.
>
> -----Mensagem original-----
> De: Paul Hsu [mailto:[EMAIL PROTECTED]
> Enviada em: terça-feira, 27 de maio de 2003 19:27
> Para: [EMAIL PROTECTED]
> Assunto: servlet question
>
>
> Hi,
>
> I try to forward a HTTP request from my servlet. I am using the following
> code.
>
> RequestDispatcher rd =
>                     getServletContext().getRequestDispatcher(direct);
> rd.forward(request, response);
>
> I have no problem with code, but I have one issue is how can I change the
> request method from "POST" to "GET" before I forward the original request.
>
> I would appreciate any help
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to