CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Unhappy How to use JSP to modify HTTP response status code?

    Hi, everyone!

    Normal HTTP response status code is like this,

    --------
    HTTP/1.1 200 OK
    --------

    I want to use JSP to modify the status code like this,

    --------
    HTTP/1.1 666 OK
    --------

    How to do the job?


    Thanks in advance,
    George

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Use HttpServletResponse.sendError(...).

    Debugging is more difficult than coding. If you are as clever as you can be when coding, how can you ever hope to debug the code?
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468
    Thanks, dlorde pal!

    I have tried your method, it really works, but
    still do not serve my purpose entirely.

    I want to modify the HTTP response code

    --------
    HTTP/1.1 200 OK
    --------

    to

    --------
    HTTP/1.1 666 hehe
    --------

    I use sendError(666, "hehe"),
    but "hehe" displays in the body and not in the header.

    What I want to do is to send error code (666) and error
    message ("hehe") through the first line of HTTP response
    header.

    How to do that job?


    Thanks in advance,
    George

  4. #4
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    I don't know, George, it's not something I've had to do. Why not try all the likely looking HttpServletResponse 'header' methods? I don't know any other way to set response header data.

    Sometimes trial and error is the best way...

    The key to personal success is initiative...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  5. #5
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Talking

    Thanks! Let me try!

    BTW: If you have got the answer, please notify me!

    :-)

    Originally posted by dlorde
    I don't know, George, it's not something I've had to do. Why not try all the likely looking HttpServletResponse 'header' methods? I don't know any other way to set response header data.

    Sometimes trial and error is the best way...

    The key to personal success is initiative...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured