Skip to content

Loading…

Embedded Jetty server #34

Merged
merged 5 commits into from

2 participants

@tomamic

Now both modules start with "mvn exec:exec"
The working "webapp" folder is now automatically created in "target"

@rik0 rik0 merged commit 479ad60 into rik0:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 8, 2013
  1. fixed typo

    mic committed
Commits on Feb 15, 2013
  1. added key for rik0

    mic committed
  2. package task

    mic committed
Commits on Feb 19, 2013
  1. embedded jetty server

    mic committed
  2. embedded jetty server

    mic committed
This page is out of date. Refresh to see the latest.
2 README.md
@@ -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 ##
View
6 blogracy-web/README.md
@@ -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.
@@ -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 ###
View
122 blogracy-web/pom.xml
@@ -9,7 +9,6 @@
<properties>
<jettyVersion>8.1.2.v20120308</jettyVersion>
</properties>
-
<dependencies>
<dependency>
@@ -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>
@@ -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>
@@ -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>
@@ -99,6 +98,10 @@
<resource>
<directory>src/main/resources</directory>
</resource>
+ <resource>
+ <directory>src/main/webapp</directory>
+ <targetPath>../webapp</targetPath>
+ </resource>
</resources>
<plugins>
@@ -112,6 +115,20 @@
</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>
<version>${jettyVersion}</version>
@@ -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>
View
BIN blogracy-web/src/main/config/blogracy.jks
Binary file not shown.
View
4 blogracy-web/src/main/config/blogracyPaths.properties
@@ -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
View
4 blogracy-web/src/main/config/blogracyUser.properties
@@ -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
View
2 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
View
23 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();
+ }
+}
Something went wrong with that request. Please try again.