Skip to content

Commit

Permalink
Merge pull request #34 from tomamic/master
Browse files Browse the repository at this point in the history
Embedded Jetty server
  • Loading branch information
rik0 committed Feb 19, 2013
2 parents b717cb6 + 57cc572 commit 479ad60
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -55,7 +55,7 @@ Issue the following command:
For more detailed information, read the instructions in the folder of each module:

* [blogracy-vuze](blogracy-vuze)
* [blogracy-web](blogracy-vuze)
* [blogracy-web](blogracy-web)

## Authors ##

Expand Down
6 changes: 3 additions & 3 deletions blogracy-web/README.md
Expand Up @@ -6,7 +6,7 @@ Blogracy is a simple peer-to-peer social networking system, built on top of Bitt
Essentially Blogracy is composed by two main modules:

1. a Vuze plugin
2. a web application
2. a Web application

This information regards the second module, the Web application.

Expand Down Expand Up @@ -57,12 +57,12 @@ With IntelliJ things mostly work out of the box.
Issue the following command:

```
mvn jetty:run
mvn exec:exec
```

Alternatively, you can deploy the webapp into any Java web container.

Blogracy web interface is available at: htpp://localhost:8080
Blogracy web interface is available at: htpp://localhost:8080/

### Executing Blogracy inside the IDE ###

Expand Down
122 changes: 81 additions & 41 deletions blogracy-web/pom.xml
Expand Up @@ -9,7 +9,6 @@
<properties>
<jettyVersion>8.1.2.v20120308</jettyVersion>
</properties>


<dependencies>
<dependency>
Expand All @@ -23,22 +22,22 @@
<artifactId>jetty-all-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-glassfish</artifactId>
<version>2.1.v20100127</version>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-glassfish</artifactId>
<version>2.1.v20100127</version>
</dependency>
<dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1-glassfish</artifactId>
<version>2.1.v20100127</version>
Expand All @@ -48,22 +47,22 @@
<artifactId>commons-codec</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.5.1</version>
Expand All @@ -73,7 +72,7 @@
<artifactId>activemq-core</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-web</artifactId>
<version>5.5.1</version>
Expand All @@ -99,6 +98,10 @@
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/webapp</directory>
<targetPath>../webapp</targetPath>
</resource>
</resources>

<plugins>
Expand All @@ -111,6 +114,20 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>java</executable>
<workingDirectory>target/</workingDirectory>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>net.blogracy.WebServer</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
Expand All @@ -124,33 +141,56 @@
<fork>true</fork>
</configuration>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-web</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-web</artifactId>
<version>5.5.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>net.blogracy.WebServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<includeProjectDependencies>true</includeProjectDependencies>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Binary file modified blogracy-web/src/main/config/blogracy.jks
Binary file not shown.
4 changes: 2 additions & 2 deletions blogracy-web/src/main/config/blogracyPaths.properties
Expand Up @@ -20,6 +20,6 @@
# THE SOFTWARE.
#

blogracy.paths.root = src/main/webapp
blogracy.paths.cache = src/main/webapp/cache
blogracy.paths.root = webapp
blogracy.paths.cache = webapp/cache

4 changes: 2 additions & 2 deletions blogracy-web/src/main/config/blogracyUser.properties
Expand Up @@ -20,8 +20,8 @@
# THE SOFTWARE.
#

blogracy.user.user = W3W7TSICZWSCUK4R7C7HMQ633GRL6YPU mic
blogracy.user.friends.1 = BLANNBXOHECW2MWHVN5AU5X4KCDDIQJZ rik0
blogracy.user.user = BLANNBXOHECW2MWHVN5AU5X4KCDDIQJZ rik0
blogracy.user.friends.1 = W3W7TSICZWSCUK4R7C7HMQ633GRL6YPU mic
blogracy.user.friends.2 = QG3PKBZU2F6CZ7AWBT6AP3BRXG6NFKI6 uno
blogracy.user.friends.3 = GDG7OPX7FJMWV74IYR2VMDPIHW5KPU2G due
blogracy.user.friends.4 = CGVGVXDXGSBLYS4VX75S5E3S7PDDCBAZ tre
2 changes: 2 additions & 0 deletions blogracy-web/src/main/config/genkey.sh
@@ -0,0 +1,2 @@
#!/bin/bash
keytool -genkey -alias $1 -keyalg RSA -keysize 512 -keystore blogracy.jks -storepass blogracy -keypass blogracy
23 changes: 23 additions & 0 deletions blogracy-web/src/main/java/net/blogracy/WebServer.java
@@ -0,0 +1,23 @@
package net.blogracy;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

public class WebServer
{
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);

WebAppContext context = new WebAppContext();
context.setDescriptor("webapp/WEB-INF/web.xml");
context.setResourceBase("webapp");
context.setContextPath("/");
context.setParentLoaderPriority(true);

server.setHandler(context);

server.start();
server.join();
}
}

0 comments on commit 479ad60

Please sign in to comment.