Author: dan.j.allen
Date: 2009-10-27 14:16:18 -0400 (Tue, 27 Oct 2009)
New Revision: 4351
Added:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java
Removed:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java
examples/trunk/wicket/numberguess/src/test/java/org/jboss/webbeans/
Modified:
examples/trunk/wicket/numberguess/pom.xml
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml
examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java
Log:
get wicket example into working state
reformat some code so that it follows conventions
Modified: examples/trunk/wicket/numberguess/pom.xml
===================================================================
--- examples/trunk/wicket/numberguess/pom.xml 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/pom.xml 2009-10-27 18:16:18 UTC (rev 4351)
@@ -12,7 +12,7 @@
<groupId>org.jboss.weld.examples</groupId>
<artifactId>weld-wicket-numberguess</artifactId>
<packaging>war</packaging>
- <name>Weld Examples: Numberguess with wicket</name>
+ <name>Weld Examples: Wicket Numberguess</name>
<dependencies>
@@ -39,7 +39,6 @@
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
@@ -82,6 +81,9 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+
<overrideWebXml>src/main/webapp/WEB-INF/jetty-additions-to-web.xml</overrideWebXml>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -126,7 +128,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>1.5.8</version>
</dependency>
<!-- JETTY DEPENDENCIES FOR IN IDE TESTING -->
@@ -140,15 +142,10 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
- <scope>test</scope>
+ <scope>runtime</scope>
<version>1.5.8</version>
</dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </dependency>
-
</dependencies>
</profile>
<profile>
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,92 +1,81 @@
-package org.jboss.weld.examples.wicket;
-
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-import javax.naming.NamingException;
-
-@SessionScoped
-public class Game implements Serializable
-{
- private int number;
-
- private int guess;
- private int smallest;
-
- @Inject
- @MaxNumber
- private int maxNumber;
-
- private int biggest;
- private int remainingGuesses;
-
- @Inject
- @Random
- Instance<Integer> randomNumber;
-
- public Game() throws NamingException {}
-
- public int getNumber()
- {
- return number;
- }
-
- public int getGuess()
- {
- return guess;
- }
-
- public void setGuess(int guess)
- {
- this.guess = guess;
- }
-
- public int getSmallest()
- {
- return smallest;
- }
-
- public int getBiggest()
- {
- return biggest;
- }
-
- public int getRemainingGuesses()
- {
- return remainingGuesses;
- }
-
- public boolean check()
- {
- if (guess>number)
- {
- biggest = guess - 1;
- }
- if (guess<number)
- {
- smallest = guess + 1;
- }
- remainingGuesses--;
- return (guess == number);
- }
+package org.jboss.weld.examples.wicket;
-
- @Inject
- Generator generator;
-
- @PostConstruct
- public void reset()
- {
- this.smallest = 0;
- this.guess = 0;
- this.remainingGuesses = 10;
- this.biggest = maxNumber;
- this.number = randomNumber.get();
- }
-
+import java.io.Serializable;
-}
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.naming.NamingException;
+
+@SessionScoped
+public class Game implements Serializable
+{
+ private int number;
+ private int guess;
+ private int smallest;
+ private int biggest;
+ private int remainingGuesses;
+
+ @Inject @MaxNumber private int maxNumber;
+
+ @Inject Generator generator;
+
+ @Inject @Random Instance<Integer> randomNumber;
+
+ public Game() throws NamingException {}
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public int getGuess()
+ {
+ return guess;
+ }
+
+ public void setGuess(int guess)
+ {
+ this.guess = guess;
+ }
+
+ public int getSmallest()
+ {
+ return smallest;
+ }
+
+ public int getBiggest()
+ {
+ return biggest;
+ }
+
+ public int getRemainingGuesses()
+ {
+ return remainingGuesses;
+ }
+
+ public boolean check()
+ {
+ if (guess>number)
+ {
+ biggest = guess - 1;
+ }
+ if (guess<number)
+ {
+ smallest = guess + 1;
+ }
+ remainingGuesses--;
+ return (guess == number);
+ }
+
+ @PostConstruct
+ public void reset()
+ {
+ this.smallest = 0;
+ this.guess = 0;
+ this.remainingGuesses = 10;
+ this.biggest = maxNumber;
+ this.number = randomNumber.get();
+ }
+}
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,20 +1,16 @@
package org.jboss.weld.examples.wicket;
-
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
-
-
@ApplicationScoped
public class Generator implements Serializable
{
-
private static final long serialVersionUID = -7213673465118041882L;
- private java.util.Random random = new java.util.Random( System.currentTimeMillis() );
+ private java.util.Random random = new java.util.Random(System.currentTimeMillis());
private int maxNumber = 100;
@@ -23,7 +19,8 @@
return random;
}
- @Produces @Random int next() {
+ @Produces @Random int next()
+ {
return getRandom().nextInt(maxNumber);
}
@@ -31,5 +28,4 @@
{
return maxNumber;
}
-
}
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,29 +1,28 @@
<html>
- <head>
- <title>Wicket Weld example</title>
- </head>
- <body>
- <h1>Guess a number...</h1>
- <form wicket:id="NumberGuessMain">
- <div style="color: red">
- <span wicket:id="messages"/>
- </div>
+ <head>
+ <title>Wicket Weld example</title>
+ </head>
+ <body>
+ <h1>Guess a number...</h1>
+ <form wicket:id="NumberGuessMain">
+ <div style="color: red">
+ <span wicket:id="messages"/>
+ </div>
- <div wicket:id="prompt">
- I'm thinking of a number between 0 and 100. You have 10 guesses.
- </div>
+ <div wicket:id="prompt">
+ I'm thinking of a number between 0 and 100. You have 10 guesses.
+ </div>
- <div>
- <span wicket:id="guessLabel">Your guess:</span>
- <input wicket:id="inputGuess" type="text"
size="3"/>
- <input wicket:id="GuessButton" type="submit"
value="Guess"/>
- <input wicket:id="RestartButton" type="submit"
value="Reset"/>
+ <div>
+ <span wicket:id="guessLabel">Your guess:</span>
+ <input wicket:id="inputGuess" type="text"
size="3"/>
+ <input wicket:id="GuessButton" type="submit"
value="Guess"/>
+ <input wicket:id="RestartButton" type="submit"
value="Reset"/>
<h:commandButton id="GuessButton" value="Guess"
action="#{game.check}" disabled="#{game.number eq game.guess}"/>
- </div>
- <div>
- <h:commandButton id="RestartButton" value="Reset"
action="#{game.reset}" immediate="true" />
- </div>
- </form>
- </body>
+ </div>
+ <div>
+ <h:commandButton id="RestartButton" value="Reset"
action="#{game.reset}" immediate="true"/>
+ </div>
+ </form>
+ </body>
</html>
-
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,90 +1,101 @@
-package org.jboss.weld.examples.wicket;
-
-import java.io.Serializable;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.Model;
-
-public class HomePage extends WebPage {
-
- private static final long serialVersionUID = 1L;
-
- @Inject
- Game game;
-
- public HomePage() {
-
-
- Form form = new Form("NumberGuessMain");
- add(form);
- form.add(new FeedbackPanel("messages").setOutputMarkupId(true));
-
- final Component prompt = new Label("prompt", new Model() {
- @Override
- public Serializable getObject()
- {
- return "I'm thinking of a number between " + game.getSmallest() +
" and " + game.getBiggest() +
- ". You have " + game.getRemainingGuesses() + " guesses.";
- }
- });
- form.add(prompt);
-
- final Component guessLabel = new Label("guessLabel","Your
Guess:");
- form.add(guessLabel);
- final Component inputGuess = new TextField("inputGuess",new Model() {
- public Serializable getObject()
- {
- return game.getGuess();
- }
- public void setObject(Object object) {
- game.setGuess(Integer.parseInt((String)object));
- }
- });
- form.add(inputGuess);
-
- final Component guessButton = new AjaxButton("GuessButton") {
- protected void onSubmit(AjaxRequestTarget target, Form form) {
- if (game.check()) {
- info("Correct!");
- setVisible(false);
- prompt.setVisible(false);
- guessLabel.setVisible(false);
- inputGuess.setVisible(false);
- }
- else if (game.getRemainingGuesses() == 0) {
- info("Sorry, the answer was " + game.getNumber());
- setVisible(false);
- guessLabel.setVisible(false);
- inputGuess.setVisible(false);
- }
- else if (game.getNumber() > game.getGuess())
- info("Higher!");
- else if (game.getNumber() < game.getGuess())
- info("Lower");
- target.addComponent(form);
- }
- };
- form.add(guessButton);
-
- form.add(new AjaxButton("RestartButton") {
- protected void onSubmit(AjaxRequestTarget target, Form form) {
- game.reset();
- guessButton.setVisible(true);
- prompt.setVisible(true);
- guessLabel.setVisible(true);
- inputGuess.setVisible(true);
- target.addComponent(form);
- }
- });
-
- }
-}
+package org.jboss.weld.examples.wicket;
+
+import java.io.Serializable;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.Model;
+
+public class HomePage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ @Inject Game game;
+
+ public HomePage()
+ {
+ Form form = new Form("NumberGuessMain");
+ add(form);
+ form.add(new FeedbackPanel("messages").setOutputMarkupId(true));
+
+ final Component prompt = new Label("prompt", new Model()
+ {
+ @Override
+ public Serializable getObject()
+ {
+ return "I'm thinking of a number between " + game.getSmallest()
+ " and " + game.getBiggest() +
+ ". You have " + game.getRemainingGuesses() + "
guesses.";
+ }
+ });
+
+ form.add(prompt);
+
+ final Component guessLabel = new Label("guessLabel","Your
Guess:");
+ form.add(guessLabel);
+ final Component inputGuess = new TextField("inputGuess",new Model()
+ {
+ public Serializable getObject()
+ {
+ return game.getGuess();
+ }
+ public void setObject(Object object)
+ {
+ game.setGuess(Integer.parseInt((String)object));
+ }
+ });
+ form.add(inputGuess);
+
+ final Component guessButton = new AjaxButton("GuessButton")
+ {
+ protected void onSubmit(AjaxRequestTarget target, Form form)
+ {
+ if (game.check())
+ {
+ info("Correct!");
+ setVisible(false);
+ prompt.setVisible(false);
+ guessLabel.setVisible(false);
+ inputGuess.setVisible(false);
+ }
+ else if (game.getRemainingGuesses() == 0)
+ {
+ info("Sorry, the answer was " + game.getNumber());
+ setVisible(false);
+ guessLabel.setVisible(false);
+ inputGuess.setVisible(false);
+ }
+ else if (game.getNumber() > game.getGuess())
+ {
+ info("Higher!");
+ }
+ else if (game.getNumber() < game.getGuess())
+ {
+ info("Lower");
+ }
+ target.addComponent(form);
+ }
+ };
+ form.add(guessButton);
+
+ form.add(new AjaxButton("RestartButton")
+ {
+ protected void onSubmit(AjaxRequestTarget target, Form form)
+ {
+ game.reset();
+ guessButton.setVisible(true);
+ prompt.setVisible(true);
+ guessLabel.setVisible(true);
+ inputGuess.setVisible(true);
+ target.addComponent(form);
+ }
+ });
+ }
+}
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,6 +1,5 @@
package org.jboss.weld.examples.wicket;
-
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
@@ -13,12 +12,10 @@
import javax.inject.Qualifier;
-
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface MaxNumber
{
-
}
Copied:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java
(from rev 4215,
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java)
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java
(rev 0)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -0,0 +1,12 @@
+package org.jboss.weld.examples.wicket;
+
+import org.jboss.weld.wicket.WeldApplication;
+
+public class NumberGuessApplication extends WeldApplication
+{
+ @Override
+ public Class getHomePage()
+ {
+ return HomePage.class;
+ }
+}
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,6 +1,5 @@
package org.jboss.weld.examples.wicket;
-
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
@@ -13,12 +12,10 @@
import javax.inject.Qualifier;
-
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface Random
{
-
}
Deleted:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,14 +0,0 @@
-package org.jboss.weld.examples.wicket;
-
-import org.jboss.weld.wicket.WeldApplication;
-
-public class SampleApplication extends WeldApplication
-{
-
- @Override
- public Class getHomePage()
- {
- return HomePage.class;
- }
-
-}
Modified:
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml
===================================================================
---
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml 2009-10-27
18:16:18 UTC (rev 4351)
@@ -1,10 +1,12 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://java.sun.com/xml/ns/j2ee
+
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-<!-- Jboss AS has a deployer that bootstraps weld, but in jetty we need this listener
-->
+ <!-- Jboss AS has a deployer that bootstraps weld, but in jetty we need this
listener -->
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
Modified: examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml 2009-10-27 18:15:01
UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml 2009-10-27 18:16:18
UTC (rev 4351)
@@ -1,23 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://java.sun.com/xml/ns/j2ee
+
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>weld-numberguess-wicket</display-name>
+ <display-name>weld-numberguess-wicket</display-name>
- <filter>
- <filter-name>wicket.numberguess-example</filter-name>
- <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
- <init-param>
- <param-name>applicationClassName</param-name>
- <param-value>org.jboss.weld.examples.wicket.SampleApplication</param-value>
- </init-param>
- </filter>
+ <filter>
+ <filter-name>Wicket Filter</filter-name>
+
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+
<param-value>org.jboss.weld.examples.wicket.NumberGuessApplication</param-value>
+ </init-param>
+ </filter>
- <filter-mapping>
- <filter-name>wicket.numberguess-example</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
+ <filter-mapping>
+ <filter-name>Wicket Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
</web-app>
Modified:
examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java
===================================================================
---
examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java 2009-10-27
18:15:01 UTC (rev 4350)
+++
examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java 2009-10-27
18:16:18 UTC (rev 4351)
@@ -5,33 +5,38 @@
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
-public class Start {
+public class Start
+{
+ public static void main(String[] args) throws Exception
+ {
+ Server server = new Server();
+ SocketConnector connector = new SocketConnector();
+ connector.setPort(8080);
+ server.setConnectors(new Connector[] { connector });
- public static void main(String[] args) throws Exception {
- Server server = new Server();
- SocketConnector connector = new SocketConnector();
- connector.setPort(8080);
- server.setConnectors(new Connector[] { connector });
+ WebAppContext bb = new WebAppContext();
+ bb.setServer(server);
+ bb.setContextPath("/");
+ bb.setWar("src/main/webapp");
+
bb.setOverrideDescriptor("src/main/webapp/WEB-INF/jetty-additions-to-web.xml");
+
+ server.addHandler(bb);
- WebAppContext bb = new WebAppContext();
- bb.setServer(server);
- bb.setContextPath("/");
- bb.setWar("src/main/webapp");
- bb.setOverrideDescriptor("src/main/webapp/WEB-INF/jetty-additions-to-web.xml");
-
- server.addHandler(bb);
-
- try {
- System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO
STOP");
- server.start();
- while (System.in.available() == 0) {
- Thread.sleep(500);
- }
- server.stop();
- server.join();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(100);
- }
- }
+ try
+ {
+ System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY
KEY TO STOP");
+ server.start();
+ while (System.in.available() == 0)
+ {
+ Thread.sleep(500);
+ }
+ server.stop();
+ server.join();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(100);
+ }
+ }
}