[mud4j-commit] SF.net SVN: mud4j: [119] trunk/mud4j-web
Status: Pre-Alpha
Brought to you by:
mpurland
|
From: <mpu...@us...> - 2007-01-14 20:52:12
|
Revision: 119
http://mud4j.svn.sourceforge.net/mud4j/?rev=119&view=rev
Author: mpurland
Date: 2007-01-14 12:52:09 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Update for functional jetty server with dependencies in classpath.
Modified Paths:
--------------
trunk/mud4j-web/.classpath
trunk/mud4j-web/pom.xml
trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java
trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java
Added Paths:
-----------
trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml
trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml
trunk/mud4j-web/src/webapp/WEB-INF/web.xml
trunk/mud4j-web/src/webapp/hello.jsp
trunk/mud4j-web/src/webapp/index.jsp
Removed Paths:
-------------
trunk/mud4j-web/resources/faces-config.xml
trunk/mud4j-web/resources/spring-config.xml
trunk/mud4j-web/resources/web.xml
Modified: trunk/mud4j-web/.classpath
===================================================================
--- trunk/mud4j-web/.classpath 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/.classpath 2007-01-14 20:52:09 UTC (rev 119)
@@ -1,8 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="src" path="src/test/unit"/>
+ <classpathentry kind="src" path="src/test/functional"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/mud4j-core"/>
- <classpathentry kind="var" path="MAVEN_REPO/javax.servlet/jars/servlet-api-2.4.jar"/>
+ <classpathentry kind="var" path="MAVEN_REPO/org.mortbay.jetty/jars/jetty-6.1.0rc3.jar" sourcepath="/OPT_JAVA/jetty-6.1.0rc3-src.zip"/>
+ <classpathentry kind="var" path="MAVEN_REPO/org.mortbay.jetty/jars/jetty-util-6.1.0rc3.jar"/>
+ <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/myfaces/core/myfaces-api/1.1.4/myfaces-api-1.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/myfaces/core/myfaces-impl/1.1.4/myfaces-impl-1.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-digester/commons-digester/1.8/commons-digester-1.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.0/jstl-1.1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jsp-api-2.1/6.1-SNAPSHOT/jsp-api-2.1-6.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jsp-2.1/6.1-SNAPSHOT/jsp-2.1-6.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/servlet-api-2.5/6.1-SNAPSHOT/servlet-api-2.5-6.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/mud4j-web/pom.xml
===================================================================
--- trunk/mud4j-web/pom.xml 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/pom.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -76,7 +76,11 @@
<artifactId>myfaces-shared-tomahawk</artifactId>
<version>2.0.3</version>
</dependency>
-
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.8</version>
+ </dependency>
</dependencies>
<build>
Deleted: trunk/mud4j-web/resources/faces-config.xml
===================================================================
--- trunk/mud4j-web/resources/faces-config.xml 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/resources/faces-config.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE faces-config PUBLIC
- "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
-<!-- JSF Myfaces configuration -->
-<faces-config>
-</faces-config>
\ No newline at end of file
Deleted: trunk/mud4j-web/resources/spring-config.xml
===================================================================
--- trunk/mud4j-web/resources/spring-config.xml 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/resources/spring-config.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- mud4j spring configuration -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
- <bean id="webServer" class="net.sf.mud4j.web.server.JettyWebServer">
- <constructor-arg type="int" value="8081" />
- </bean>
-</beans>
\ No newline at end of file
Deleted: trunk/mud4j-web/resources/web.xml
===================================================================
--- trunk/mud4j-web/resources/web.xml 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/resources/web.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" id="WebApp_ID">
-
- <listener>
- <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
- </listener>
-
- <description>web.xml</description>
- <display-name>mud4j web application</display-name>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/spring-config.xml</param-value>
- </context-param>
-
-</web-app>
\ No newline at end of file
Modified: trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java 2007-01-14 20:52:09 UTC (rev 119)
@@ -33,15 +33,14 @@
public class Mud4jServer {
public static void main(String[] args) {
- AbstractApplicationContext appContext = new ClassPathXmlApplicationContext(
- new String[] { "spring-config.xml" } );
- BeanFactory beanFactory = (BeanFactory) appContext;
+// AbstractApplicationContext appContext = new ClassPathXmlApplicationContext(
+// new String[] { "spring-config.xml" } );
+// BeanFactory beanFactory = (BeanFactory) appContext;
+//
+// appContext.registerShutdownHook();
- appContext.registerShutdownHook();
+ WebServer webServer = new JettyWebServer("src/webapp", "/", 8081);
- // Get our WebServer bean from our Spring beans
- WebServer webServer = (WebServer) beanFactory.getBean("webServer", WebServer.class);
-
try {
webServer.start();
}
Modified: trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java 2007-01-14 20:52:09 UTC (rev 119)
@@ -23,10 +23,15 @@
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.HandlerContainer;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.thread.BoundedThreadPool;
/**
@@ -42,13 +47,23 @@
// Port to listen on
private int port;
+
+ // Resource base path
+ private String resourceBasePath;
+
+ // Context path
+ private String contextPath;
/**
* Constructor to provide configurable port listener.
*
+ * @param resourceBasePath Path on the classpath for resources
+ * @param contextPath Http context path for serving resources
* @param port Port to listen on.
*/
- public JettyWebServer(int port) {
+ public JettyWebServer(String resourceBasePath, String contextPath, int port) {
+ this.resourceBasePath = resourceBasePath;
+ this.contextPath = contextPath;
this.port = port;
}
@@ -68,19 +83,35 @@
threadPool.setMaxThreads(100);
server.setThreadPool(threadPool);
- Handler handler = new AbstractHandler()
- {
-
- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
- response.setContentType("text/html");
- response.setStatus(HttpServletResponse.SC_OK);
- response.getWriter().println("<h1>testing</h1>");
- ((Request)request).setHandled(true);
-
- }
- };
- server.setHandler(handler);
+// Handler handler = new AbstractHandler()
+// {
+//
+// public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
+// response.setContentType("text/html");
+// response.setStatus(HttpServletResponse.SC_OK);
+// response.getWriter().println("<h1>testing</h1>");
+// ((Request)request).setHandled(true);
+//
+// }
+// };
+// server.setHandler(handler);
+// ContextHandler context = new ContextHandler();
+// context.setContextPath("/");
+// context.setResourceBase(".");
+// context.setClassLoader(Thread.currentThread().getContextClassLoader());
+// server.setHandler(context);
+
+// ContextHandlerCollection contexts = new ContextHandlerCollection();
+// server.setHandler(contexts);
+ WebAppContext context = new WebAppContext();
+ context.setResourceBase(resourceBasePath);
+ context.setContextPath(contextPath);
+ server.setHandler(context);
+
+
+// WebAppContext.addWebApplications(server, "resources", "jetty-webdefault.xml", true, false);
+
server.setStopAtShutdown(true);
server.setConnectors(new Connector[] { connector });
Modified: trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java
===================================================================
--- trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java 2007-01-14 18:55:21 UTC (rev 118)
+++ trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java 2007-01-14 20:52:09 UTC (rev 119)
@@ -35,7 +35,7 @@
public void setUp() {
- server = new JettyWebServer(JETTY_PORT);
+ server = new JettyWebServer("src/webapp", "/", JETTY_PORT);
// Runnable serverRunnable = new WebServerThread(server) {
//
Copied: trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml (from rev 117, trunk/mud4j-web/resources/faces-config.xml)
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<!-- JSF Myfaces configuration -->
+<faces-config>
+ <navigation-rule>
+ <from-view-id>/index.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>login</from-outcome>
+ <to-view-id>/hello.jsp</to-view-id>
+ </navigation-case>
+
+ </navigation-rule>
+
+</faces-config>
\ No newline at end of file
Copied: trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml (from rev 117, trunk/mud4j-web/resources/spring-config.xml)
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml (rev 0)
+++ trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- mud4j spring configuration -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
+</beans>
\ No newline at end of file
Copied: trunk/mud4j-web/src/webapp/WEB-INF/web.xml (from rev 117, trunk/mud4j-web/resources/web.xml)
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/mud4j-web/src/webapp/WEB-INF/web.xml 2007-01-14 20:52:09 UTC (rev 119)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4" id="WebApp_ID">
+
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>
+ org.springframework.web.context.request.RequestContextListener</listener-class>
+ </listener>
+
+ <description>web.xml</description>
+ <display-name>mud4j web application</display-name>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/spring-config.xml</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.faces</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Added: trunk/mud4j-web/src/webapp/hello.jsp
===================================================================
--- trunk/mud4j-web/src/webapp/hello.jsp (rev 0)
+++ trunk/mud4j-web/src/webapp/hello.jsp 2007-01-14 20:52:09 UTC (rev 119)
@@ -0,0 +1,16 @@
+<html>
+ <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+ <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+ <f:view>
+ <head>
+ <title>A Simple JavaServer Faces Application (login)</title>
+ </head>
+ <body>
+ Hi there!
+ <h:form>
+ <h:commandButton value="Back" action="index"/>
+ </h:form>
+ </body>
+ </f:view>
+</html>
\ No newline at end of file
Added: trunk/mud4j-web/src/webapp/index.jsp
===================================================================
--- trunk/mud4j-web/src/webapp/index.jsp (rev 0)
+++ trunk/mud4j-web/src/webapp/index.jsp 2007-01-14 20:52:09 UTC (rev 119)
@@ -0,0 +1,32 @@
+<html>
+ <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+ <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+ <f:view>
+ <head>
+ <title>A Simple JavaServer Faces Application (login)</title>
+ </head>
+ <body>
+ <h:form>
+ <h3>Please enter your name and password.</h3>
+ <table>
+ <tr>
+ <td>Name:</td>
+ <td>
+
+ </td>
+ </tr>
+ <tr>
+ <td>Password:</td>
+ <td>
+ </td>
+ </tr>
+ </table>
+ <p>
+ <h:commandButton value="Login" action="login"/>
+ </p>
+ <b>
+ </h:form>
+ </body>
+ </f:view>
+</html>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|