Thread: [mud4j-commit] SF.net SVN: mud4j: [65] trunk/mud4j-web
Status: Pre-Alpha
Brought to you by:
mpurland
|
From: <mpu...@us...> - 2006-12-24 23:12:18
|
Revision: 65
http://mud4j.svn.sourceforge.net/mud4j/?rev=65&view=rev
Author: mpurland
Date: 2006-12-24 15:12:17 -0800 (Sun, 24 Dec 2006)
Log Message:
-----------
Update mud4j-web project and add initial controllers.
Modified Paths:
--------------
trunk/mud4j-web/.classpath
Added Paths:
-----------
trunk/mud4j-web/project.xml
trunk/mud4j-web/src/
trunk/mud4j-web/src/java/
trunk/mud4j-web/src/java/net/
trunk/mud4j-web/src/java/net/sf/
trunk/mud4j-web/src/java/net/sf/mud4j/
trunk/mud4j-web/src/java/net/sf/mud4j/web/
trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java
Modified: trunk/mud4j-web/.classpath
===================================================================
--- trunk/mud4j-web/.classpath 2006-12-24 23:11:05 UTC (rev 64)
+++ trunk/mud4j-web/.classpath 2006-12-24 23:12:17 UTC (rev 65)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path=""/>
+ <classpathentry kind="src" path="src/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path=""/>
+ <classpathentry combineaccessrules="false" kind="src" path="/mud4j-core"/>
+ <classpathentry kind="var" path="MAVEN_REPO/javax.servlet/jars/servlet-api-2.4.jar"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/mud4j-web/project.xml
===================================================================
--- trunk/mud4j-web/project.xml (rev 0)
+++ trunk/mud4j-web/project.xml 2006-12-24 23:12:17 UTC (rev 65)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
+ <extend>${basedir}/../mud4j/project-root.xml</extend>
+ <shortDescription>
+ mud4j web.
+ </shortDescription>
+ <description>
+ mud4j web.
+ </description>
+ <pomVersion>3</pomVersion>
+ <name>mud4j web</name>
+ <!--<groupId>net.sf</groupId>-->
+ <package>net.sf.mud4j</package>
+ <artifactId>mud4j-web</artifactId>
+ <currentVersion>1.0-SNAPSHOT</currentVersion>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>net.sf</groupId>
+ <artifactId>mud4j-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.0.cr5</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>jar</defaultGoal>
+ <sourceDirectory>src/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test/unit</unitTestSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/resources</directory>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/resources/logging</directory>
+ <includes>
+ <include>log4j.properties</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </unitTest>
+ </build>
+</project>
+
Property changes on: trunk/mud4j-web/project.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java 2006-12-24 23:12:17 UTC (rev 65)
@@ -0,0 +1,55 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.mud4j.account.Account;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+
+/**
+ * Login controller to handle incoming login requests.
+ *
+ * @author Matthew Purland
+ */
+public class LoginController implements Controller {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ String username = request.getParameter("username");
+ String password = request.getParameter("password");
+
+ Account account = null;
+
+ if (account == null) {
+ return new ModelAndView("Error", "message",
+ "Invalid username or password. Login failed." );
+ }
+ else {
+ UserSession session = new UserSession(account);
+
+ request.getSession().setAttribute("userSession", session);
+
+ return new ModelAndView("index");
+ }
+ }
+
+}
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java 2006-12-24 23:12:17 UTC (rev 65)
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+
+/**
+ * Controller to control logging out and ending a user session.
+ *
+ * @author Matthew Purland
+ */
+public class LogoutController implements Controller {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ UserSession session = (UserSession) request.getAttribute("userSession");
+
+ if (session != null) {
+
+ }
+ }
+
+}
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java 2006-12-24 23:12:17 UTC (rev 65)
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+import java.io.Serializable;
+
+import net.sf.mud4j.account.Account;
+
+/**
+ * User session for storing session.
+ *
+ * @author Matthew Purland
+ */
+public class UserSession implements Serializable {
+
+ private Account account;
+
+ /**
+ * Create a user session and associate it with an account.
+ *
+ * @param account Account to associate the session with.
+ */
+ public UserSession(Account account) {
+ this.account = account;
+ }
+
+ /**
+ * Get the account.
+ *
+ * @return the account.
+ */
+ public Account getAccount() {
+ return this.account;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mpu...@us...> - 2006-12-25 05:28:20
|
Revision: 71
http://mud4j.svn.sourceforge.net/mud4j/?rev=71&view=rev
Author: mpurland
Date: 2006-12-24 21:28:19 -0800 (Sun, 24 Dec 2006)
Log Message:
-----------
Update logout controller.
Modified Paths:
--------------
trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
Property Changed:
----------------
trunk/mud4j-web/
Property changes on: trunk/mud4j-web
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java 2006-12-25 05:27:00 UTC (rev 70)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java 2006-12-25 05:28:19 UTC (rev 71)
@@ -37,6 +37,8 @@
if (session != null) {
}
+
+ return null;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mpu...@us...> - 2007-09-29 21:56:21
|
Revision: 141
http://mud4j.svn.sourceforge.net/mud4j/?rev=141&view=rev
Author: mpurland
Date: 2007-09-29 14:56:16 -0700 (Sat, 29 Sep 2007)
Log Message:
-----------
Update with login and logout controllers
Modified Paths:
--------------
trunk/mud4j-web/.classpath
trunk/mud4j-web/.project
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/UserSession.java
trunk/mud4j-web/src/site/xdoc/ideas.xml
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
Added Paths:
-----------
trunk/mud4j-web/resources/hsqldb/
trunk/mud4j-web/resources/hsqldb/data.log
trunk/mud4j-web/resources/hsqldb/data.properties
trunk/mud4j-web/resources/hsqldb/data.script
trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/
trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LoginController.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LogoutController.java
trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/WebFunctionalTestSuite.java
trunk/mud4j-web/src/webapp/login.jsp
Removed Paths:
-------------
trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
trunk/mud4j-web/src/webapp/hello.jsp
trunk/mud4j-web/src/webapp/index.jsp
Modified: trunk/mud4j-web/.classpath
===================================================================
--- trunk/mud4j-web/.classpath 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/.classpath 2007-09-29 21:56:16 UTC (rev 141)
@@ -3,6 +3,7 @@
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/test/unit"/>
<classpathentry kind="src" path="src/test/functional"/>
+ <classpathentry kind="src" path="src/webapp"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/mud4j-core"/>
<classpathentry kind="var" path="MAVEN_REPO/org.mortbay.jetty/jars/jetty-6.1.0rc3.jar" sourcepath="/OPT_JAVA/jetty-6.1.0rc3-src.zip"/>
@@ -20,5 +21,12 @@
<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="var" path="M2_REPO/org/apache/myfaces/tomahawk/tomahawk/1.1.5-SNAPSHOT/tomahawk-1.1.5-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-dbcp/commons-dbcp/1.2/commons-dbcp-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.3/commons-pool-1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6/dom4j-1.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.0.cr5/hibernate-3.2.0.cr5.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/mud4j-web/.project
===================================================================
--- trunk/mud4j-web/.project 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/.project 2007-09-29 21:56:16 UTC (rev 141)
@@ -3,6 +3,7 @@
<name>mud4j-web</name>
<comment></comment>
<projects>
+ <project>mud4j-core</project>
</projects>
<buildSpec>
<buildCommand>
@@ -10,8 +11,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>tk.eclipse.plugin.jsf.JSFProjectBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>tk.eclipse.plugin.jsf.JSFProjectNature</nature>
</natures>
</projectDescription>
Modified: trunk/mud4j-web/pom.xml
===================================================================
--- trunk/mud4j-web/pom.xml 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/pom.xml 2007-09-29 21:56:16 UTC (rev 141)
@@ -81,6 +81,26 @@
<artifactId>commons-digester</artifactId>
<version>1.8</version>
</dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
</dependencies>
<build>
Added: trunk/mud4j-web/resources/hsqldb/data.log
===================================================================
--- trunk/mud4j-web/resources/hsqldb/data.log (rev 0)
+++ trunk/mud4j-web/resources/hsqldb/data.log 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,5 @@
+/*C1*/SET SCHEMA PUBLIC
+CONNECT USER SA
+DISCONNECT
+/*C2*/SET SCHEMA PUBLIC
+CONNECT USER SA
Added: trunk/mud4j-web/resources/hsqldb/data.properties
===================================================================
--- trunk/mud4j-web/resources/hsqldb/data.properties (rev 0)
+++ trunk/mud4j-web/resources/hsqldb/data.properties 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,17 @@
+#HSQL Database Engine 1.8.0.5
+#Sat Jun 23 16:24:40 CDT 2007
+hsqldb.script_format=0
+runtime.gc_interval=0
+sql.enforce_strict_size=false
+hsqldb.cache_size_scale=8
+readonly=false
+hsqldb.nio_data_file=true
+hsqldb.cache_scale=14
+version=1.8.0
+hsqldb.default_table_type=memory
+hsqldb.cache_file_scale=1
+hsqldb.log_size=200
+modified=yes
+hsqldb.cache_version=1.7.0
+hsqldb.original_version=1.8.0
+hsqldb.compatible_version=1.8.0
Added: trunk/mud4j-web/resources/hsqldb/data.script
===================================================================
--- trunk/mud4j-web/resources/hsqldb/data.script (rev 0)
+++ trunk/mud4j-web/resources/hsqldb/data.script 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,4 @@
+CREATE SCHEMA PUBLIC AUTHORIZATION DBA
+CREATE USER SA PASSWORD ""
+GRANT DBA TO SA
+SET WRITE_DELAY 10
Deleted: trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -1,55 +0,0 @@
-/**
- * Copyright 2006 Matthew Purland (m.p...@gm...)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.mud4j.web;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import net.sf.mud4j.account.Account;
-
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.mvc.Controller;
-
-/**
- * Login controller to handle incoming login requests.
- *
- * @author Matthew Purland
- */
-public class LoginController implements Controller {
-
- /**
- * {@inheritDoc}
- */
- public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
- String username = request.getParameter("username");
- String password = request.getParameter("password");
-
- return null;
-
-// if (account == null) {
-// return new ModelAndView("Error", "message",
-// "Invalid username or password. Login failed." );
-// }
-// else {
-// UserSession session = new UserSession(account);
-//
-// request.getSession().setAttribute("userSession", session);
-//
-// return new ModelAndView("index");
-// }
- }
-
-}
Deleted: trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -1,44 +0,0 @@
-/**
- * Copyright 2006 Matthew Purland (m.p...@gm...)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.mud4j.web;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.mvc.Controller;
-
-/**
- * Controller to control logging out and ending a user session.
- *
- * @author Matthew Purland
- */
-public class LogoutController implements Controller {
-
- /**
- * {@inheritDoc}
- */
- public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
- UserSession session = (UserSession) request.getAttribute("userSession");
-
- if (session != null) {
-
- }
-
- return null;
- }
-
-}
Modified: trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -45,7 +45,7 @@
webServer.start();
}
catch (IOException e) {
- System.out.println(e);
+ System.err.println(e);
}
}
}
Modified: trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/UserSession.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -39,7 +39,7 @@
}
/**
- * Get the account.
+ * Get the account that owns the session.
*
* @return the account.
*/
Copied: trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LoginController.java (from rev 117, trunk/mud4j-web/src/java/net/sf/mud4j/web/LoginController.java)
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LoginController.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LoginController.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,92 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web.controller;
+
+import org.springframework.dao.DataAccessException;
+
+import net.sf.mud4j.dao.AccountDao;
+
+/**
+ * Login controller to handle incoming login requests.
+ *
+ * @author Matthew Purland
+ */
+public class LoginController {
+ // Username for the login
+ private String username;
+ // Password for the login
+ private String password;
+
+ // Account dao for verifying login
+ private AccountDao accountDao;
+
+ public LoginController(AccountDao accountDao) {
+ this.accountDao = accountDao;
+ }
+
+ /**
+ * Verify login to the delegated account.
+ * @return
+ */
+ public String verifyLogin() {
+ try {
+ //accountDao.loadAccount(username, password);
+ }
+ catch (DataAccessException e) {
+ return "failure";
+ }
+
+ return "success";
+ }
+
+
+ /**
+ * Get the username.
+ *
+ * @return the username.
+ */
+ public String getUsername() {
+ return this.username;
+ }
+
+
+ /**
+ * Set the username.
+ *
+ * @param username the username to set.
+ */
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ /**
+ * Get the password.
+ *
+ * @return the password.
+ */
+ public String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * Set the password.
+ *
+ * @param password the password to set.
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
Copied: trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LogoutController.java (from rev 117, trunk/mud4j-web/src/java/net/sf/mud4j/web/LogoutController.java)
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LogoutController.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/controller/LogoutController.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.mud4j.web.UserSession;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+
+/**
+ * Controller to control logging out and ending a user session.
+ *
+ * @author Matthew Purland
+ */
+public class LogoutController implements Controller {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ UserSession session = (UserSession) request.getAttribute("userSession");
+
+ if (session != null) {
+
+ }
+
+ return null;
+ }
+
+}
Modified: trunk/mud4j-web/src/site/xdoc/ideas.xml
===================================================================
--- trunk/mud4j-web/src/site/xdoc/ideas.xml 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/site/xdoc/ideas.xml 2007-09-29 21:56:16 UTC (rev 141)
@@ -23,6 +23,8 @@
the form of JSF components</li>
<li>Will provide functional testing of mud4j-web through
Selenium tests.</li>
+
+ <li>Use Jabber HTTP bindings for separate method for connection to server</li>
</ul>
</body>
</document>
\ No newline at end of file
Added: trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/WebFunctionalTestSuite.java
===================================================================
--- trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/WebFunctionalTestSuite.java (rev 0)
+++ trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/WebFunctionalTestSuite.java 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+/**
+ * Web functional test suite using SRC.
+ */
+public class WebFunctionalTestSuite {
+
+}
Modified: trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/webapp/WEB-INF/faces-config.xml 2007-09-29 21:56:16 UTC (rev 141)
@@ -5,13 +5,29 @@
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- JSF Myfaces configuration -->
<faces-config>
+
+ <application>
+ <variable-resolver>
+ org.springframework.web.jsf.DelegatingVariableResolver
+ </variable-resolver>
+ </application>
+
+
+<!--
+<managed-bean>
+ <description>Login controller</description>
+ <managed-bean-name>login</managed-bean-name>
+ <managed-bean-class>net.sf.mud4j.web.controller.LoginController</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+</managed-bean>
+-->
+
<navigation-rule>
- <from-view-id>/index.jsp</from-view-id>
+ <from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
- <to-view-id>/hello.jsp</to-view-id>
+ <to-view-id>/login.jsp</to-view-id>
</navigation-case>
-
</navigation-rule>
</faces-config>
\ No newline at end of file
Modified: trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/webapp/WEB-INF/spring-config.xml 2007-09-29 21:56:16 UTC (rev 141)
@@ -1,11 +1,68 @@
<?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="
+ 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">
+ <!-- DataSource Property -->
+ <bean id="hsqlDataSource" class="org.apache.commons.dbcp.BasicDataSource">
+ <property name="driverClassName">
+ <value>org.hsqldb.jdbcDriver</value>
+ </property>
+ <property name="url">
+ <value>jdbc:hsqldb:file:resources/hsqldb/data</value>
+ </property>
+ <property name="username">
+ <value>sa</value>
+ </property>
+ <property name="password">
+ <value></value>
+ </property>
+ </bean>
+
+ <!-- Database Property -->
+ <bean id="hsqlHibernateProperties"
+ class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="properties">
+ <props>
+ <prop key="hibernate.hbm2ddl.auto">update</prop>
+ <prop key="hibernate.dialect">
+ org.hibernate.dialect.HSQLDialect</prop>
+ <prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
+ <prop key="hibernate.show_sql">false</prop>
+ <prop key="hibernate.c3p0.minPoolSize">5</prop>
+ <prop key="hibernate.c3p0.maxPoolSize">20</prop>
+ <prop key="hibernate.c3p0.timeout">600</prop>
+ <prop key="hibernate.c3p0.max_statement">50</prop>
+ <prop key="hibernate.c3p0.testConnectionOnCheckout">false</prop>
+ </props>
+ </property>
+ </bean>
+
+ <!-- Hibernate SessionFactory -->
+ <bean id="hibernateSessionFactory"
+ class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+ <property name="dataSource">
+ <ref local="hsqlDataSource"/>
+ </property>
+ <property name="hibernateProperties">
+ <ref bean="hsqlHibernateProperties"/>
+ </property>
+
+ </bean>
+
+ <bean name="accountDao"
+ class="net.sf.mud4j.dao.hibernate.AccountDaoHibernate">
+ <property name="sessionFactory" ref="hibernateSessionFactory"/>
+ </bean>
+
+ <bean name="login" class="net.sf.mud4j.web.controller.LoginController">
+ <constructor-arg>
+ <ref bean="accountDao"/>
+ </constructor-arg>
+ </bean>
</beans>
\ No newline at end of file
Modified: trunk/mud4j-web/src/webapp/WEB-INF/web.xml
===================================================================
--- trunk/mud4j-web/src/webapp/WEB-INF/web.xml 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/webapp/WEB-INF/web.xml 2007-09-29 21:56:16 UTC (rev 141)
@@ -6,11 +6,13 @@
<listener>
<listener-class>
- org.springframework.web.context.ContextLoaderListener</listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
</listener>
<listener>
<listener-class>
- org.springframework.web.context.request.RequestContextListener</listener-class>
+ org.springframework.web.context.request.RequestContextListener
+ </listener-class>
</listener>
<description>web.xml</description>
@@ -21,6 +23,11 @@
<param-value>/WEB-INF/spring-config.xml</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.faces.application.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
@@ -29,10 +36,6 @@
<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
Deleted: trunk/mud4j-web/src/webapp/hello.jsp
===================================================================
--- trunk/mud4j-web/src/webapp/hello.jsp 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/webapp/hello.jsp 2007-09-29 21:56:16 UTC (rev 141)
@@ -1,16 +0,0 @@
-<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
Deleted: trunk/mud4j-web/src/webapp/index.jsp
===================================================================
--- trunk/mud4j-web/src/webapp/index.jsp 2007-09-29 21:42:59 UTC (rev 140)
+++ trunk/mud4j-web/src/webapp/index.jsp 2007-09-29 21:56:16 UTC (rev 141)
@@ -1,32 +0,0 @@
-<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
Copied: trunk/mud4j-web/src/webapp/login.jsp (from rev 119, trunk/mud4j-web/src/webapp/hello.jsp)
===================================================================
--- trunk/mud4j-web/src/webapp/login.jsp (rev 0)
+++ trunk/mud4j-web/src/webapp/login.jsp 2007-09-29 21:56:16 UTC (rev 141)
@@ -0,0 +1,22 @@
+<%@ page contentType="text/html; charset=UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:inputText id="username" value="#{login.username}" required="true" />
+ <h:inputSecret id="password" value="#{login.password}" required="true"/>
+ <h:commandButton id="loginCmd" value="Login" action="#{login.verifyLogin}" />
+ <h:message for="username" styleClass="errorText"/>
+ <h:message for="password" styleClass="errorText"/>
+ </h:form>
+ </f:view>
+ </body>
+</html>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mpu...@us...> - 2007-01-14 00:37:12
|
Revision: 102
http://mud4j.svn.sourceforge.net/mud4j/?rev=102&view=rev
Author: mpurland
Date: 2007-01-13 16:29:38 -0800 (Sat, 13 Jan 2007)
Log Message:
-----------
Add basic server functionality.
Added Paths:
-----------
trunk/mud4j-web/resources/
trunk/mud4j-web/resources/faces-config.xml
trunk/mud4j-web/resources/spring-config.xml
trunk/mud4j-web/resources/web.xml
trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/server/
trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java
trunk/mud4j-web/src/java/net/sf/mud4j/web/server/WebServer.java
Added: trunk/mud4j-web/resources/faces-config.xml
===================================================================
--- trunk/mud4j-web/resources/faces-config.xml (rev 0)
+++ trunk/mud4j-web/resources/faces-config.xml 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,8 @@
+<?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
Added: trunk/mud4j-web/resources/spring-config.xml
===================================================================
--- trunk/mud4j-web/resources/spring-config.xml (rev 0)
+++ trunk/mud4j-web/resources/spring-config.xml 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,15 @@
+<?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
Added: trunk/mud4j-web/resources/web.xml
===================================================================
--- trunk/mud4j-web/resources/web.xml (rev 0)
+++ trunk/mud4j-web/resources/web.xml 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,19 @@
+<?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
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/Mud4jServer.java 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+import java.io.IOException;
+
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import net.sf.mud4j.web.server.JettyWebServer;
+import net.sf.mud4j.web.server.WebServer;
+
+/**
+ * Provides web by using embedded web server.
+ *
+ * @author Matthew Purland
+ */
+public class Mud4jServer {
+
+ public static void main(String[] args) {
+ AbstractApplicationContext appContext = new ClassPathXmlApplicationContext(
+ new String[] { "spring-config.xml" } );
+ BeanFactory beanFactory = (BeanFactory) appContext;
+
+ appContext.registerShutdownHook();
+
+ // Get our WebServer bean from our Spring beans
+ WebServer webServer = (WebServer) beanFactory.getBean("webServer", WebServer.class);
+
+ try {
+ webServer.start();
+ }
+ catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+}
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/server/JettyWebServer.java 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,130 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web.server;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.thread.BoundedThreadPool;
+
+/**
+ * Provide a Jetty webserver that will use classes on the classpath or as
+ * specified to configure the container.
+ *
+ * @author Matthew Purland
+ */
+public class JettyWebServer implements WebServer {
+
+ // Jetty server
+ private Server server;
+
+ // Port to listen on
+ private int port;
+
+ /**
+ * Constructor to provide configurable port listener.
+ *
+ * @param port Port to listen on.
+ */
+ public JettyWebServer(int port) {
+ this.port = port;
+ }
+
+ /**
+ * Configure server servlets and configurations.
+ *
+ * @throws IOException in case of Jetty configuration setup problem
+ */
+ protected void configureAndStartServer() throws IOException {
+ try {
+ server = new Server();
+ Connector connector = new SelectChannelConnector();
+ connector.setPort(port);
+
+ // Create a thread pool to control number of threads for requests
+ BoundedThreadPool threadPool = new BoundedThreadPool();
+ 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);
+
+ server.setStopAtShutdown(true);
+ server.setConnectors(new Connector[] { connector });
+
+ server.start();
+ //server.join();
+ }
+ catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start() throws IOException {
+ configureAndStartServer();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop() throws IOException {
+ if (server != null) {
+ try {
+ server.stop();
+ }
+ catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isStarted() {
+ return server.isStarted();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isStopped() {
+ return server.isStopped();
+ }
+
+}
Added: trunk/mud4j-web/src/java/net/sf/mud4j/web/server/WebServer.java
===================================================================
--- trunk/mud4j-web/src/java/net/sf/mud4j/web/server/WebServer.java (rev 0)
+++ trunk/mud4j-web/src/java/net/sf/mud4j/web/server/WebServer.java 2007-01-14 00:29:38 UTC (rev 102)
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web.server;
+
+import java.io.IOException;
+
+/**
+ * Provide interface for configuring a web server.
+ *
+ * @author Matthew Purland
+ */
+public interface WebServer {
+ /**
+ * Start the webserver.
+ *
+ * @throws IOException in case of I/O problems or the server won't start.
+ */
+ void start() throws IOException;
+
+ /**
+ * Stop the webserver.
+ *
+ * @throws IOException in case of I/O problems or if it can't stop the server.
+ */
+ void stop() throws IOException;
+
+ /**
+ * Whether the web server is started.
+ *
+ * @return Returns whether the web server is currently started.
+ */
+ boolean isStarted();
+
+ /**
+ * Whether the web server is stopped.
+ *
+ * @returns Returns whether the web server is stopped.
+ */
+ boolean isStopped();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|