- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 06 Aug 2009 10:13:30 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3/unicorn In directory hutz:/tmp/cvs-serv23605/src/org/w3/unicorn Modified Files: Tag: dev2 Init.java Controller.java Log Message: generated routes with xbean Index: Controller.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3/unicorn/Attic/Controller.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- Controller.java 5 Aug 2009 17:21:40 -0000 1.1.2.1 +++ Controller.java 6 Aug 2009 10:13:28 -0000 1.1.2.2 @@ -5,8 +5,10 @@ import javax.servlet.http.*; import org.apache.log4j.Logger; +import org.w3.unicorn.route.Route; //import org.w3c.unicorn.route.Route; //import org.w3c.unicorn.route.RouteParser; +import org.w3.unicorn.route.RouteParser; public class Controller extends HttpServlet { private static final long serialVersionUID = 1L; @@ -29,17 +31,15 @@ } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - /*logger.info("Processing request: " + request.getRequestURL()); + logger.info("Processing request: " + request.getRequestURL()); Route route = RouteParser.getRoute(request); - if (!route.isRedirect()) - logger.info("Coresponding action: " + route.getAction()); - if (route.isRedirect()) { - response.sendRedirect(route.getUrl().toString()); - } else { + if (route.isSetUrl()) + response.sendRedirect(route.getUrl()); + else if (route.isSetAction()) { RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(route.getAction()); if (dispatcher == null) { - String error = "ERROR: " + route.getAction() + " does not corespond to any servlet in web.xml"; + String error = "ERROR: " + route.getAction() + " does not corespond to any servlet-name in web.xml"; logger.error(error); response.sendError(501, error); } else { @@ -50,7 +50,11 @@ response.sendError(501, "ERROR: " + e.getMessage()); } } - }*/ + } else { + String error = "ERROR: No action associated with this route. Check route.xml."; + logger.error(error); + response.sendError(501, error); + } } static { Index: Init.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3/unicorn/Attic/Init.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- Init.java 5 Aug 2009 17:21:39 -0000 1.1.2.1 +++ Init.java 6 Aug 2009 10:13:28 -0000 1.1.2.2 @@ -4,6 +4,7 @@ import java.net.URI; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; +import org.w3.unicorn.route.RouteParser; import org.w3.unicorn.util.Property; import org.w3.unicorn.util.UCNProperties; @@ -30,8 +31,8 @@ System.out.println("OK - \"unicorn.home\" was found: " + unicornHome.getPath()); } - // Log4j initialization attempt - String log4jPath = unicornHome.getPath() + "WEB-INF/conf/log4j.properties"; + // Log4j initialisation attempt + String log4jPath = unicornHome.getPath() + "/WEB-INF/conf/log4j.properties"; File log4jPropFile = new File(log4jPath); if (!log4jPropFile.exists()) { String error = "WARN: \"log4j.properties\" could not be found: " + log4jPath; @@ -49,7 +50,7 @@ // Loading unicorn.properties logger.debug("Loading unicorn.properties"); - String unicornPath = unicornHome.getPath() + "WEB-INF/conf/unicorn.properties"; + String unicornPath = unicornHome.getPath() + "/WEB-INF/conf/unicorn.properties"; logger.debug("Unicorn properties file = " + unicornPath); File unicornPropFile = new File(unicornPath); if (!unicornPropFile.exists()) { @@ -67,7 +68,7 @@ } // Initialising RouteParser - + RouteParser.init();
Received on Thursday, 6 August 2009 10:13:43 UTC