2002/css-validator/org/w3c/css/servlet CssValidator.java,1.33,1.34

Update of /sources/public/2002/css-validator/org/w3c/css/servlet
In directory hutz:/tmp/cvs-serv30049/org/w3c/css/servlet

Modified Files:
	CssValidator.java 
Log Message:
Adding some HTTP Headers to the result page so people can know if it is valid and how many errors there are just by reading the headers.

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- CssValidator.java	30 Jul 2007 13:47:48 -0000	1.33
+++ CssValidator.java	9 Aug 2007 09:31:04 -0000	1.34
@@ -62,6 +62,7 @@
     final static String server_name = "Jigsaw/2.2.2 "
 	+ "W3C_CSS_Validator_JFouffa/2.0";
 
+    final static String headers_name = "X-W3C-Validator-";
     /**
      * Create a new CssValidator.
      */
@@ -654,9 +655,13 @@
 	}
 	PrintWriter out = getLocalPrintWriter(res.getOutputStream(), ac
 					      .getContentEncoding());
+	int nb_errors = styleSheet.getErrors().getErrorCount();
+    res.setHeader(headers_name + "Errors", String.valueOf(nb_errors));
+    res.setHeader(headers_name + "Status", nb_errors == 0 ? "Valid" : "Invalid");
 
 	try {
 	    style.print(out);
+	    
 	} finally {
 	    out.close();
 	}
@@ -754,6 +759,7 @@
 
 	ErrorReport error = ErrorReportFactory.getErrorReport(ac, title, output,
 							      e, validURI);
+    res.setHeader(headers_name + "Status", "Abort");
 
 	try {
 	    error.print(out);

Received on Thursday, 9 August 2007 09:33:36 UTC