Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded Jetty server #34

Merged
merged 5 commits into from Feb 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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: For more detailed information, read the instructions in the folder of each module:


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


## Authors ## ## 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: Essentially Blogracy is composed by two main modules:


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


This information regards the second module, the 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: Issue the following command:


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


Alternatively, you can deploy the webapp into any Java web container. 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 ### ### Executing Blogracy inside the IDE ###


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



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


<plugins> <plugins>
Expand All @@ -111,6 +114,20 @@
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </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> <plugin>
<groupId>org.mortbay.jetty</groupId> <groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId> <artifactId>jetty-maven-plugin</artifactId>
Expand All @@ -124,33 +141,56 @@
<fork>true</fork> <fork>true</fork>
</configuration> </configuration>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.6.4</version> <version>1.6.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.14</version> <version>1.2.14</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId> <artifactId>activemq-all</artifactId>
<version>5.5.1</version> <version>5.5.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId> <artifactId>activemq-core</artifactId>
<version>5.5.1</version> <version>5.5.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-web</artifactId> <artifactId>activemq-web</artifactId>
<version>5.5.1</version> <version>5.5.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </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> </plugins>
</build> </build>
</project> </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. # THE SOFTWARE.
# #


blogracy.paths.root = src/main/webapp blogracy.paths.root = webapp
blogracy.paths.cache = src/main/webapp/cache 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. # THE SOFTWARE.
# #


blogracy.user.user = W3W7TSICZWSCUK4R7C7HMQ633GRL6YPU mic blogracy.user.user = BLANNBXOHECW2MWHVN5AU5X4KCDDIQJZ rik0
blogracy.user.friends.1 = BLANNBXOHECW2MWHVN5AU5X4KCDDIQJZ rik0 blogracy.user.friends.1 = W3W7TSICZWSCUK4R7C7HMQ633GRL6YPU mic
blogracy.user.friends.2 = QG3PKBZU2F6CZ7AWBT6AP3BRXG6NFKI6 uno blogracy.user.friends.2 = QG3PKBZU2F6CZ7AWBT6AP3BRXG6NFKI6 uno
blogracy.user.friends.3 = GDG7OPX7FJMWV74IYR2VMDPIHW5KPU2G due blogracy.user.friends.3 = GDG7OPX7FJMWV74IYR2VMDPIHW5KPU2G due
blogracy.user.friends.4 = CGVGVXDXGSBLYS4VX75S5E3S7PDDCBAZ tre 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();
}
}