Changeset 898:efaa9262ed7d

Show
Ignore:
Timestamp:
10/23/09 11:44:38 (4 years ago)
Author:
tgambet
Branch:
default
convert_revision:
svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@899
Message:

changed X-W3C-Validator-Status possible values to Passed/Failed/Abort?
+ response code 500 if no observation has been made

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/org/w3c/unicorn/action/ObserveAction.java

    r788 r898  
    1 // $Id: ObserveAction.java,v 1.55 2009-10-16 16:51:00 tgambet Exp $ 
     1// $Id: ObserveAction.java,v 1.56 2009-10-23 11:44:38 tgambet Exp $ 
    22// Author: Jean-Guilhem Rouel & Thomas GAMBET 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    287287                                        } 
    288288                                        if (errors > 0) 
    289                                                 resp.setHeader("X-W3C-Validator-Status", "Invalid"); 
     289                                                resp.setHeader("X-W3C-Validator-Status", "Failed"); 
    290290                                        else 
    291                                                 resp.setHeader("X-W3C-Validator-Status", "Valid"); 
     291                                                resp.setHeader("X-W3C-Validator-Status", "Passed"); 
    292292                                        resp.setHeader("X-W3C-Validator-Errors", Integer.toString(errors)); 
    293293                                        resp.setHeader("X-W3C-Validator-Warnings", Integer.toString(warnings)); 
    294294                                        resp.setHeader("X-W3C-Validator-Info", Integer.toString(infos)); 
     295                                } else { 
     296                                        aOutputModule.produceOutput(mapOfStringObject, resp.getWriter()); 
    295297                                } 
    296                                  
    297                                  
    298                                 aOutputModule.produceOutput(mapOfStringObject, resp.getWriter()); 
    299298                        } 
    300299                } catch (final UnicornException e) { 
    301                         if (e.getUnicornMessage() != null) 
    302                                 messages.add(e.getUnicornMessage()); 
    303                         else if (e.getMessage() != null) 
    304                                 messages.add(new Message(Message.ERROR, e.getMessage(), null)); 
    305                         aOutputModule.produceError(mapOfStringObject, resp.getWriter()); 
     300                        resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 
     301                        if (req.getMethod().equals("HEAD")) { 
     302                                resp.setHeader("X-W3C-Validator-Status", "Abort"); 
     303                        } else { 
     304                                if (e.getUnicornMessage() != null) 
     305                                        messages.add(e.getUnicornMessage()); 
     306                                else if (e.getMessage() != null) 
     307                                        messages.add(new Message(Message.ERROR, e.getMessage(), null)); 
     308                                aOutputModule.produceError(mapOfStringObject, resp.getWriter()); 
     309                        } 
    306310                } catch (final Exception aException) { 
    307311                        logger.error("Exception : " + aException.getMessage(), aException);