2006/unicorn/src/org/w3c/unicorn/action ObserveAction.java,1.55,1.56

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv2064/src/org/w3c/unicorn/action

Modified Files:
	ObserveAction.java 
Log Message:
changed X-W3C-Validator-Status possible values to Passed/Failed/Abort
+ response code 500 if no observation has been made

Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- ObserveAction.java	16 Oct 2009 16:51:00 -0000	1.55
+++ ObserveAction.java	23 Oct 2009 11:44:38 -0000	1.56
@@ -286,23 +286,27 @@
 						infos += observationList.get(key).getInfoCount();
 					}
 					if (errors > 0)
-						resp.setHeader("X-W3C-Validator-Status", "Invalid");
+						resp.setHeader("X-W3C-Validator-Status", "Failed");
 					else
-						resp.setHeader("X-W3C-Validator-Status", "Valid");
+						resp.setHeader("X-W3C-Validator-Status", "Passed");
 					resp.setHeader("X-W3C-Validator-Errors", Integer.toString(errors));
 					resp.setHeader("X-W3C-Validator-Warnings", Integer.toString(warnings));
 					resp.setHeader("X-W3C-Validator-Info", Integer.toString(infos));
+				} else {
+					aOutputModule.produceOutput(mapOfStringObject, resp.getWriter());
 				}
-				
-				
-				aOutputModule.produceOutput(mapOfStringObject, resp.getWriter());
 			}
 		} catch (final UnicornException e) {
-			if (e.getUnicornMessage() != null)
-				messages.add(e.getUnicornMessage());
-			else if (e.getMessage() != null)
-				messages.add(new Message(Message.ERROR, e.getMessage(), null));
-			aOutputModule.produceError(mapOfStringObject, resp.getWriter());
+			resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			if (req.getMethod().equals("HEAD")) {
+				resp.setHeader("X-W3C-Validator-Status", "Abort");
+			} else {
+				if (e.getUnicornMessage() != null)
+					messages.add(e.getUnicornMessage());
+				else if (e.getMessage() != null)
+					messages.add(new Message(Message.ERROR, e.getMessage(), null));
+				aOutputModule.produceError(mapOfStringObject, resp.getWriter());
+			}
 		} catch (final Exception aException) {
 			logger.error("Exception : " + aException.getMessage(), aException);
 			messages.add(new Message(aException));

Received on Friday, 23 October 2009 11:44:44 UTC