Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
git-svn-id: http://strand3.com/svn/private/trunk/BrowserVPN@309 42119495-8021-0410-92ea-b7df3c3667d7
  • Loading branch information
Greg Hewett committed Jan 8, 2005
1 parent cc686d8 commit b098afa
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 69 deletions.
10 changes: 10 additions & 0 deletions .classpath
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="TOMCAT_HOME/common/lib/servlet-api.jar"/>
<classpathentry kind="var" path="TOMCAT_HOME/common/lib/jasper-runtime.jar"/>
<classpathentry kind="var" path="TOMCAT_HOME/common/lib/jsp-api.jar"/>
<classpathentry output="web/WEB-INF/classes" kind="src" path="src"/>
<classpathentry kind="var" path="TOMCAT_HOME/common/lib/commons-collections-3.1.jar"/>
<classpathentry kind="output" path="web/WEB-INF/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .cvsignore
@@ -1,2 +1,3 @@
build
dist
work
23 changes: 23 additions & 0 deletions .project
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BrowserVPN</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.sse.core.structuredbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.sysdeo.eclipse.tomcat.tomcatnature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions .tomcatplugin
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<tomcatProjectProperties>
<rootDir>/web</rootDir>
<exportSource>false</exportSource>
<reloadable>true</reloadable>
<redirectLogger>false</redirectLogger>
<updateXml>true</updateXml>
<warLocation></warLocation>
<extraInfo></extraInfo>
<webPath>/BrowserVPN</webPath>
</tomcatProjectProperties>
3 changes: 1 addition & 2 deletions src/com/strand3/app/AppActionAdapter.java
Expand Up @@ -38,8 +38,7 @@ public int getIntParameter(HttpServletRequest request, String paramName, int def
public static String handleException(Object host, HttpServletRequest request, Exception e) {
request.setAttribute("exception", e);
request.setAttribute("message", "Error in action handler "+host.getClass().getName());
return "common/error.jsp";

return "error.jsp";
}

public String handleException(HttpServletRequest request, Exception e) {
Expand Down
26 changes: 20 additions & 6 deletions src/com/strand3/app/AppControl.java
Expand Up @@ -32,21 +32,35 @@ public void doGet (HttpServletRequest req, HttpServletResponse res)

try {
// create action handler class by name
Class actionclass=null;
Class actionclass;

try {
actionclass = Class.forName(getInitParameter("defaultClass") + "." + pathsplit[1]);
} catch (ClassNotFoundException cnf) {
actionclass = Class.forName(getInitParameter("defaultClass") +
"." + pathsplit[1]);
}
catch (ClassNotFoundException cnf) {
//Try searching for the class directly
actionclass = Class.forName(pathsplit[1]);
//actionclass = Class.forName(pathsplit[1]);

//We should return a 404 here, but I am not sure how to do that.
res.addHeader("status", "404");
//RequestDispatcher dispatcher = req.getRequestDispatcher(getInitParameter("viewsDir") + "error.jsp");
//dispatcher.forward(req, res);
return;
}
AppAction actionhandler = (AppAction)actionclass.newInstance();

// polymorphic call to abstract run() method
// Create default properties.
req.setAttribute("title", "BrowserVPN");

// polymorphic call to abstract run() method
String view=actionhandler.run(req);
req.setAttribute("title", "umm");

// Add view directory to the beginning of the view
view = getInitParameter("viewsDir") + view;



// forward to view returned from actionhandler
RequestDispatcher dispatcher = req.getRequestDispatcher(view);
dispatcher.forward(req, res);
Expand Down
@@ -1,9 +1,3 @@
/*
* Created on Dec 8, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.strand3.manager;

import javax.servlet.http.HttpServletRequest;
Expand All @@ -15,17 +9,17 @@
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Login extends AppActionAdapter {
public class Home extends AppActionAdapter {

public String run (HttpServletRequest req) {

// set page attributes
req.setAttribute("title", "Login");
req.setAttribute("title", req.getAttribute("title") + " - Login");

// if the method is get, then this is probably the first time on
// this page.
if (req.getMethod() == "GET") {
return "login.jsp";
return "error.jsp";
}

// It is required for the user to provide and username and a
Expand All @@ -38,6 +32,13 @@ public String run (HttpServletRequest req) {
if (0 == req.getParameter("password").length()) {
handleException(req, new Exception("Username is required"));
}

if (req.getParameter("username") == "greg" &&
req.getParameter("password") == "greg") {
req.setAttribute("title", req.getAttribute("title") + " - Home");
return "home.jsp";
}

return "login.jsp";
}
}
1 change: 1 addition & 0 deletions web/WEB-INF/.cvsignore
@@ -0,0 +1 @@
classes
Binary file removed web/WEB-INF/lib/jstl.jar
Binary file not shown.
Binary file modified web/WEB-INF/lib/standard.jar
Binary file not shown.
15 changes: 12 additions & 3 deletions web/WEB-INF/web.xml
Expand Up @@ -3,8 +3,12 @@
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<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">

<display-name>Browser VPN</display-name>
<description>
Expand All @@ -16,6 +20,11 @@
<taglib-uri>http://jakarta.apache.org/taglibs/input-1.0</taglib-uri>
<taglib-location>/WEB-INF/taglibs-input.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/standard-1.0</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

<servlet>
<servlet-name>myproxy</servlet-name>
Expand Down Expand Up @@ -66,4 +75,4 @@
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
-->
</web-app>
</web-app>
3 changes: 3 additions & 0 deletions web/index.jsp
@@ -0,0 +1,3 @@
<%
response.sendRedirect("App/Home");
%>
52 changes: 28 additions & 24 deletions web/static/default.css
@@ -1,87 +1,91 @@
body {
background-color: #cbcbcb;
font-family: arial, sans-serif;
background-color: #ffffff;
font-size: 10pt;
}

#document {
margin: 10px;
margin-left: 15px;
bottom: 10px;
background-color: #ffffff;
border: 1px solid #0000cb;
width: 720px;
height: 100%;
}

#document h1 {
color: #0000cb;
#header {
padding: 10px;
font-size: 16pt;
}

#content {
padding: 25px;
}

#DataEntryPrompt {
#prompt {
font-size: 16px;
font-weight: bold;
padding: 10px;
margin-top: 10px;
border-top: solid;
border-top: 1px solid #000000;
}

#DataSubEntryPrompt {
#subprompt {
font-size: 16px;
font-weight: bold;
padding: 10px;
margin-top: 10px;
}

#DataEntryComponent {
#component {
position: relative;
width: 100%;
padding: 10px;
padding: 5px;
}
#DataEntryRadio {

#radiobutton {
position: absolute;
top: 8px;
}
#DataEntryCheckBox {

#checkbox {
position: absolute;
top: 8px;
}
#DataEntryText {

#textfield {
position: relative;
left: 30px;
}
#DataEntryTextArea {

#textarea {
position: relative;
left: 30px;
}
#DataEntryFile {

#fileupload {
position: relative;
left: 30px;
}
#DataEntrySelect {

#select {
position: relative;
left: 30px;
}
#DataEntrySubmit {

#submit {
position: relative;
border-top: solid;
border-top: 1px solid #000000;
padding-left: 10px;
padding-top: 10px;
border-color-top: #000033;
border-width-top: thin;
}
#DataEntryLabel {

#label {
position: relative;
font-size: 12px;
font-weight: bold;
left: 30px;
margin-right:30px;
}
#DataEntryDescription {

#description {
position: relative;
font-size: 11px;
left: 30px;
Expand Down
7 changes: 3 additions & 4 deletions web/views/error.jsp
@@ -1,4 +1,3 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div id='DataEntry'>
There was an error!
</div>
<jsp:include page="/views/header.jsp" />
<div id='DataEntry'>There was an error!</div>
<jsp:include page="/views/footer.jsp" />
6 changes: 4 additions & 2 deletions web/views/header.jsp
Expand Up @@ -2,10 +2,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>browserVPN - <c:out value="${title}" escapeXml="false" /></title>
<title><c:out value="${title}"/></title>
<link rel="stylesheet" type="text/css" href="../static/default.css" />
<script type="text/javascript" src="../static/default.js"></script>
</head>
<body>
<div id='document'>
<h1><c:out value="${title}" escapeXml="false"/></h1>
<div id='header'>
<c:out value="${title}"/>
</div>
3 changes: 3 additions & 0 deletions web/views/home.jsp
@@ -0,0 +1,3 @@
<jsp:include page="/views/header.jsp" />
<h1>Home Page</h1>
<jsp:include page="/views/footer.jsp" />
34 changes: 15 additions & 19 deletions web/views/login.jsp
@@ -1,33 +1,29 @@
<!-- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -->
<%@ taglib uri="/WEB-INF/taglibs-input.tld" prefix="input" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<jsp:include page="/views/header.jsp" />

<div id='content'>

<div id="DataEntryPrompt">BrowserVPN</div>
<form action="Login" method="POST">
<div id='DataEntryLabel'>Login Form</div>
<div id='DataEntryDescription'>
Please Login with your username and password
</div>

<div id='DataEntryComponent'>
<div id="DataEntryLabel">Username</div>
<div id="DataEntryText">
<input type='text' name='username' value='' />
<div id='prompt'>Please Login</div>
<form name="Login" action='Home' method='POST'>
<div id='component'>
<div id='label'>Username</div>
<div id='textfield'>
<input:text name="username" default=""/>
</div>
</div>

<div id='DataEntryComponent'>
<div id="DataEntryLabel">Password</div>
<div id="DataEntryText">
<input type='password' name='password' value='' />
<div id='component'>
<div id='label'>Password</div>
<div id='textfield'>
<input:password name="password" default=""/>
</div>
</div>

<div id="DataEntrySubmit">
<input type="submit" name="action" value="submit" />
</div>
<div id='submit'>
<input type="submit" name="action" value="Login" />
</div>
</form>
</div>

Expand Down

0 comments on commit b098afa

Please sign in to comment.