- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 05 Jan 2010 13:50:01 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/servlet
In directory hutz:/tmp/cvs-serv25562/org/w3c/css/servlet
Modified Files:
CssValidator.java check.java
Log Message:
Implementation of css3-background (partial, missing background-color and background, also borders not done)
cf. http://www.w3.org/TR/2009/CR-css3-background-20091217/
moved and corrected implementation of css3-multicol
cf. http://www.w3.org/TR/2009/CR-css3-multicol-20091217/
Some reorganization of code.
Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- CssValidator.java 26 Feb 2009 10:41:25 -0000 1.42
+++ CssValidator.java 5 Jan 2010 13:49:59 -0000 1.43
@@ -7,22 +7,6 @@
package org.w3c.css.servlet;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.ProtocolException;
-import java.net.URL;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.w3c.css.css.CssParser;
import org.w3c.css.css.DocumentParser;
import org.w3c.css.css.StyleReport;
@@ -44,6 +28,21 @@
import org.w3c.www.mime.MimeType;
import org.w3c.www.mime.MimeTypeFormatException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.ProtocolException;
+import java.net.URL;
+
/**
* This class is a servlet to use the validator.
*
@@ -195,7 +194,7 @@
*
* @param req
* encapsulates the request to the servlet.
- * @param resp
+ * @param res
* encapsulates the response from the servlet.
* @exception ServletException
* if the request could not be handled.
@@ -459,7 +458,7 @@
*
* @param req
* encapsulates the request to the servlet
- * @param resp
+ * @param res
* encapsulates the response from the servlet
* @exception ServletException
* if the request could not be handled
Index: check.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/check.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- check.java 24 Feb 2009 21:45:14 -0000 1.14
+++ check.java 5 Jan 2010 13:49:59 -0000 1.15
@@ -7,17 +7,14 @@
package org.w3c.css.servlet;
-import java.io.IOException;
-
-import java.net.URLEncoder;
-
-import java.util.Enumeration;
-
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.Enumeration;
/**
* This class is a servlet to use the validator.
@@ -34,72 +31,71 @@
* It redirects to the value contained in "Referer"
*
* @param req encapsulates the request to the servlet.
- * @param resp encapsulates the response from the servlet.
- * @exception ServletException if the request could not be handled.
- * @exception IOException if detected when handling the request.
+ * @param res encapsulates the response from the servlet.
+ * @throws ServletException if the request could not be handled.
+ * @throws IOException if detected when handling the request.
*/
public void doGet(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException
- {
+ throws ServletException, IOException {
- String uri = req.getHeader("Referer");
- String encodeEnc = req.getCharacterEncoding();
- if (encodeEnc == null) {
- encodeEnc = "8859_1";
- }
- uri = URLEncoder.encode(uri, encodeEnc);
+ String uri = req.getHeader("Referer");
+ String encodeEnc = req.getCharacterEncoding();
+ if (encodeEnc == null) {
+ encodeEnc = "8859_1";
+ }
+ uri = URLEncoder.encode(uri, encodeEnc);
- if (uri == null) {
- res.setContentType("text/plain");
- res.sendError(400, "Referer field empty");
- return;
- }
- res.setHeader("Cache-Control", "max-age=86400");
- res.setHeader("Vary", "Referer");
+ if (uri == null) {
+ res.setContentType("text/plain");
+ res.sendError(400, "Referer field empty");
+ return;
+ }
+ res.setHeader("Cache-Control", "max-age=86400");
+ res.setHeader("Vary", "Referer");
- Enumeration e = req.getParameterNames();
- StringBuilder sb = new StringBuilder(validatorURI);
- boolean first = true;
- boolean uridone = false;
+ Enumeration e = req.getParameterNames();
+ StringBuilder sb = new StringBuilder(validatorURI);
+ boolean first = true;
+ boolean uridone = false;
- if (e != null) {
- while (e.hasMoreElements()) {
- String paramname = (String) e.nextElement();
- String paramvalue = req.getParameter(paramname);
- if ("uri".equals(paramname)) {
- uridone = true;
- paramvalue = uri;
- }
- if (first) {
- sb.append('?');
- first = false;
- } else {
- sb.append('&');
- }
- sb.append(paramname);
- if (paramvalue != null) {
- sb.append('=');
- sb.append(paramvalue);
- }
- }
- }
- if (!uridone) {
- if (first) {
- sb.append("?uri=");
- } else {
- sb.append("&uri=");
- }
- sb.append(uri);
- }
- res.sendRedirect(sb.toString());
+ if (e != null) {
+ while (e.hasMoreElements()) {
+ String paramname = (String) e.nextElement();
+ String paramvalue = req.getParameter(paramname);
+ if ("uri".equals(paramname)) {
+ uridone = true;
+ paramvalue = uri;
+ }
+ if (first) {
+ sb.append('?');
+ first = false;
+ } else {
+ sb.append('&');
+ }
+ sb.append(paramname);
+ if (paramvalue != null) {
+ sb.append('=');
+ sb.append(paramvalue);
+ }
+ }
+ }
+ if (!uridone) {
+ if (first) {
+ sb.append("?uri=");
+ } else {
+ sb.append("&uri=");
+ }
+ sb.append(uri);
+ }
+ res.sendRedirect(sb.toString());
}
public void init(ServletConfig config) throws ServletException {
- super.init(config);
- if (config.getInitParameter("validatorURI") == null) {
- validatorURI = "validator";
- } else {
- validatorURI = config.getInitParameter("validatorURI");
- }
+ super.init(config);
+ if (config.getInitParameter("validatorURI") == null) {
+ validatorURI = "validator";
+ } else {
+ validatorURI = config.getInitParameter("validatorURI");
+ }
}
}
Received on Tuesday, 5 January 2010 13:50:03 UTC