Skip to content
Browse files

embedded jetty server

  • Loading branch information...
1 parent 2546e86 commit 948e7ed403a837fe161a5be708840ca3f45cdf63 mic committed Feb 19, 2013
View
4 blogracy-web/README.md
@@ -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
101 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,39 +141,39 @@
<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.Blogracy</mainClass>
+ <mainClass>net.blogracy.WebServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
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
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();
+ }
+}

0 comments on commit 948e7ed

Please sign in to comment.
Something went wrong with that request. Please try again.