• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doPost Servlet called by wget needs addHeader logic

 
JLS Steff
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I invoke my doPost Servlet using a wget --post-data. This works fine and the response for OK and Failure are working. However, I cannot correctly code the addHeader statement. Will the header text be generated as output automatically?
Any ideas?
.........
String h_mainname="StatusAdmin";
String h_name="StatusUpdate";
........
.......
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{

response.setContentType("text/html");
// the next line is incorrect
public void addHeader(java.lang.String h_name, java.lang.String h_val);

String lname = request.getParameter("lname");
String task = request.getParameter("task");

response .setStatus(response.SC_OK, "All is Well");
}
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


That is the signature of the method addHeader in the HttpServletResponse interface, not valid code for a doPost method.

If you don't understand the difference you need to get back to basics.

Bill
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the comment was accurate anyway
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic