- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 22 Jul 2009 14:54:23 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/tests In directory hutz:/tmp/cvs-serv14881 Modified Files: FirstServlet.java Log Message: Automatically add http:// + fixed logging Index: FirstServlet.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tests/FirstServlet.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- FirstServlet.java 23 Sep 2008 13:53:58 -0000 1.13 +++ FirstServlet.java 22 Jul 2009 14:54:21 -0000 1.14 @@ -46,7 +46,7 @@ */ public class FirstServlet extends HttpServlet { - private static final Log logger = LogFactory.getLog("org.w3c.unicorn"); + private static final Log logger = LogFactory.getLog("org.w3c.unicorn.servlet"); private static final long serialVersionUID = -1375355420965607571L; @@ -68,7 +68,7 @@ new File(Property.get("UPLOADED_FILES_REPOSITORY"))); try { - IndexGenerator.generateIndexes(); + IndexGenerator.generateIndexes(); } catch (final ResourceNotFoundException e) { FirstServlet.logger.error("ResourceNotFoundException : "+e.getMessage(), e); @@ -128,9 +128,9 @@ aUnicornCall.setLang(templateLang + "," + aLocale); } - for ( - final Enumeration aEnumParamName = aHttpServletRequest.getParameterNames(); - aEnumParamName.hasMoreElements();) { + for ( final Enumeration aEnumParamName = aHttpServletRequest.getParameterNames(); + aEnumParamName.hasMoreElements();) + { final String sParamName = (String) aEnumParamName.nextElement(); final String[] tStringParamValue = aHttpServletRequest.getParameterValues(sParamName); @@ -365,6 +365,13 @@ } else if (sParamName.equals("uri")) { aUnicornCall.setEnumInputMethod(EnumInputMethod.URI); + + if(!tStringParamValue[0].substring(0,7).equals("http://")) { + FirstServlet.logger.info("URI missing protocol : " + tStringParamValue[0]); + tStringParamValue[0] = "http://" + tStringParamValue[0]; + FirstServlet.logger.info("URI modified to : " + tStringParamValue[0]); + } + aUnicornCall.setDocumentName(tStringParamValue[0]); aUnicornCall.setInputParameterValue(tStringParamValue[0]); }
Received on Wednesday, 22 July 2009 14:54:32 UTC