[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. |