Dear all,
I'm quite new using HttpServlets, that's why I hope you can help me!
I'm using an HttpServlet on Tomcat 5 that is prepared to receive POST HTTP 
requests from remote machines.

If I use an html form and I submit a text to this servlet (method post), the 
get parameter of the http servlet returns the text content ok (with or without 
the % character in the text).

When this form, instead of submitting directly to the http servlet, submits to 
another program in background (ex: a php program), which then does the post to 
the servlet, the result is:
The get parameter returns null if the text has the % character (and so we 
cannot see anything from the text).

It is not a problem of the background program, because if the program posts a 
simple php file, just to show the text contest, we can see the text ok, even 
with the % character. This only happens if the program posts to the this 
HTTPservlet. Furthermore, this problem happens also to other users who wish to 
POST requests to this HTTP Servlet. Those users have their own programs and in 
then they POST the text to our HTTP Servlet.

Am I missing any important detail about char encoding?

I'll send you an example of my HTTPServlet code to help you on the 
troubleshooting.

Hope you can help me!!!
Tiago

________________________________________________________________________
public class teste extends HttpServlet {

public void init(ServletConfig config) throws ServletException {
super.init(config);

}

public void destroy() {

}


// HTTP <code>POST</code> method.

protected void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException 
{

String text= request.getParameter("message");
writeAnswer("TEXT: " + text );
/* ---- Debug part ---
}

/******** Aux Function********/

protected void writeAnswer(HttpServletRequest request, HttpServletResponse 
response, String message)
throws ServletException, IOException {
response.setContentType("text/html");
//response.setContentType("charset=ISO-8859-4");
PrintWriter out = response.getWriter();
out.println(Constants.BEGIN_HTML_PAGE);
out.println(message); 
out.println(Constants.END_HTML_PAGE);
out.close();
}

}//end class

Tiago

__________________________________________________________
Quanto gasta de Acesso � Internet? Fa�a as contas!
http://acesso.portugalmail.pt/contas

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

Reply via email to