Skip to content

Commit

Permalink
Run script and server class added.
Browse files Browse the repository at this point in the history
Todo.
  • Loading branch information
mathias committed Aug 5, 2010
1 parent c0a9fc0 commit 9e5a673
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
.classpath
.settings/
/target/
#/src/main/todo/todo.tmp
/src/main/todo/todo.tmp
/src/main/todo/todo.txt.bak
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>todo.txt-wicket</groupId>
<artifactId>todo.txt-wicket</artifactId>
<packaging>jar</packaging>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>todo.txt-wicket</name>
<url>http://maven.apache.org</url>
Expand Down Expand Up @@ -100,11 +100,13 @@
<artifactId>wicket-datetime</artifactId>
<version>${wicket.version}</version>
</dependency>
-->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
Expand Down
21 changes: 21 additions & 0 deletions src/main/bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
######################################
# - todo.txt-wicket
# - bin
# - run.sh
# - webapp
# - `unzip todo.txt-wicket-*.war`
######################################
MAINPATH=".."
CONTEXTPATH="/"
WARPATH="$MAINPATH/webapp"
LIBRARY="$WARPATH/WEB-INF/lib"
CLASSES="$WARPATH/WEB-INF/classes"
KEYSTORE="$CLASSES/keystore"
SSLPORT="8443"
KEYSTOREPASSWORD="somepass"

CLASSPATH="$CLASSES"
for a in $LIBRARY/*.jar; do CLASSPATH=$CLASSPATH:$a; done

/usr/bin/java -Dkeystore=$KEYSTORE -Dkeystorepassword=$KEYSTOREPASSWORD -Dcontextpath_0=$CONTEXTPATH -Dwarpath_0=$WARPATH -Dsslport=$SSLPORT -cp $CLASSPATH com.todotxt.todotxtwicket.common.StartJettySsl
77 changes: 77 additions & 0 deletions src/main/java/com/todotxt/todotxtwicket/common/StartJettySsl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.todotxt.todotxtwicket.common;

import java.util.ArrayList;
import java.util.List;

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.security.SslSocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.todotxt.todotxtjava.Util;

public class StartJettySsl {

private static final String KEYSTORE = "keystore";
private static final String KEYSTOREPASSWORD = "keystorepassword";
private static final String SSLPORT = "sslport";
private static final String HANDLERS = "handlers";
private static final String WARPATH = "warpath_";
private static final String CONTEXTPATH = "contextpath_";

private final static Logger log = LoggerFactory.getLogger(StartJettySsl.class);

public static void main(String[] args) {
//server specific
String password = System.getProperty(KEYSTOREPASSWORD, "jetty6");
String keystore = System.getProperty(KEYSTORE, "src/main/resources/keystore");
int sslPort = Integer.parseInt(System.getProperty(SSLPORT, "8443"));
int handlers = Integer.parseInt(System.getProperty(HANDLERS, "10"));

Server jettyServer = null;
try {
jettyServer = new Server();

SslSocketConnector sslConn = new SslSocketConnector();
sslConn.setPort(sslPort);
sslConn.setPassword(password);
sslConn.setKeystore(keystore);
sslConn.setKeyPassword(password);

jettyServer.setConnectors(new Connector[] { sslConn });

List<WebAppContext> contexts = new ArrayList<WebAppContext>();
for (int i = 0; i < handlers; i++) {
String war = System.getProperty(WARPATH+i);
String contextPath = System.getProperty(CONTEXTPATH+i);
if(!Util.isEmpty(war) && !Util.isEmpty(contextPath)){
contexts.add(new WebAppContext(war, contextPath));
}
}
int ncxt = contexts.size();
if(ncxt == 0){
contexts.add(new WebAppContext("src/main/webapp", "/"));
ncxt = 1;
}

jettyServer.setHandlers(contexts.toArray(new Handler[0]));

jettyServer.start();
log.info("SSL Server started on port=" + sslPort + ", keystore="
+ keystore + " webapps=" + ncxt);
} catch (Exception e) {
log.error("Could not start the Jetty server: " + e, e);
if (jettyServer != null) {
try {
jettyServer.stop();
} catch (Exception e1) {
log.error("Unable to stop the jetty server: " + e1, e1);
}
}
}
}

}
9 changes: 9 additions & 0 deletions src/main/todo/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ Search or pressing a prio, proj or context creates a bread crumb track. With a c
Select todo.txt file, e.g. todo0/todo.txt, todo1/todo.txt...
Improve GUI design and layout. Border, table with visible cells.
(A) Bug: Add/Update does not display change on save.
Exclude search field.
Auto complete search field input.
Clear search field when clearing search filters.
Logout should go to login screen. setResponsePage TodoListPage?
Prio sort should be default.
Display logged in username, e.g. Sign out USERNAME.
One filter string, e.g. f1 f2 f3 f4.
Project and context dropdown for filtering.
Show current date.

0 comments on commit 9e5a673

Please sign in to comment.