Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bean Validation for Wicket 6

  • Loading branch information...
commit 63034255006f43d8aa87433958893bd244bd274b 0 parents
dilgerm authored
194 pom.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.effectivetrainings</groupId>
+ <artifactId>bean-validations</artifactId>
+ <packaging>war</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <!-- TODO project name -->
+ <name>quickstart</name>
+ <description></description>
+ <!--
+ <organization>
+ <name>company name</name>
+ <url>company url</url>
+ </organization>
+ -->
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <properties>
+ <wicket.version>6.4.0</wicket.version>
+ <jetty.version>7.6.3.v20120416</jetty.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <!-- WICKET DEPENDENCIES -->
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-core</artifactId>
+ <version>${wicket.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-bean-validation</artifactId>
+ <version>0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.3.0.Final</version>
+ </dependency>
+
+ <!-- OPTIONAL DEPENDENCY
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-extensions</artifactId>
+ <version>${wicket.version}</version>
+ </dependency>
+ -->
+
+ <!-- LOGGING DEPENDENCIES - LOG4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.6.4</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+
+ <!-- JUNIT DEPENDENCY FOR TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- JETTY DEPENDENCIES FOR TESTING -->
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all-server</artifactId>
+ <version>${jetty.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <filtering>false</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <filtering>false</filtering>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <encoding>UTF-8</encoding>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>${jetty.version}</version>
+ <configuration>
+ <connectors>
+ <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <port>8080</port>
+ <maxIdleTime>3600000</maxIdleTime>
+ </connector>
+ <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
+ <port>8443</port>
+ <maxIdleTime>3600000</maxIdleTime>
+ <keystore>${project.build.directory}/test-classes/keystore</keystore>
+ <password>wicket</password>
+ <keyPassword>wicket</keyPassword>
+ </connector>
+ </connectors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>Apache Nexus</id>
+ <url>https://repository.apache.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </project>
12 src/main/java/de/effectivetrainings/ExtendedValidation.java
@@ -0,0 +1,12 @@
+package de.effectivetrainings;
+
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author martindilger
+ * Date: 06.01.13
+ * Time: 17:43
+ */
+public interface ExtendedValidation {
+}
20 src/main/java/de/effectivetrainings/HomePage.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <head>
+ <meta charset="utf-8" />
+ <title>Apache Wicket Quickstart</title>
+ <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+ <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
+ </head>
+ <body style="padding: 25px">
+ <div wicket:id="feedback"/>
+ <form wicket:id="form">
+ <input type="text" wicket:id="name"/> <br/>
+ <input type="text" wicket:id="email"/> <br/>
+ <input type="text" wicket:id="phone"/> <br/>
+ <input type="text" wicket:id="birthDay"/> <br/>
+ <select wicket:id="license"/> <br/>
+ <input type="submit"/>
+ </form>
+ </body>
+</html>
39 src/main/java/de/effectivetrainings/HomePage.java
@@ -0,0 +1,39 @@
+package de.effectivetrainings;
+
+import org.apache.wicket.bean.validation.Property;
+import org.apache.wicket.bean.validation.PropertyValidator;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+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.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.markup.html.WebPage;
+
+import java.util.Arrays;
+
+public class HomePage extends WebPage {
+ private static final long serialVersionUID = 1L;
+
+ public HomePage(final PageParameters parameters) {
+ super(parameters);
+ IModel<Trainer> trainerModel = Model.of(new Trainer());
+ add(new FeedbackPanel("feedback"));
+ Form<Trainer> form = new Form<Trainer>("form", new CompoundPropertyModel<Trainer>(trainerModel));
+ form.add(new TextField("name")
+ .add(new PropertyValidator(new Property(Trainer.class,"name"))));
+ form.add(new TextField("email")
+ .add(new PropertyValidator(new Property(Trainer.class,"email"))));
+ form.add(new TextField("phone")
+ .add(new PropertyValidator(new Property(Trainer.class,"phone"))));
+ form.add(new TextField("birthDay")
+ .add(new PropertyValidator(new Property(Trainer.class,"birthDay"))));
+ form.add(new DropDownChoice<License>("license",
+ Arrays.asList(License.values()))
+ .add(new PropertyValidator(
+ new Property(Trainer.class,"license"),TrainerGroupSequence.class)));
+ add(form);
+ }
+}
8 src/main/java/de/effectivetrainings/HomePage.properties
@@ -0,0 +1,8 @@
+name.Required=Bitte geben Sie Ihren Namen ein
+email.Required=Bitte geben Sie Ihre E-Mailadresse ein.
+email.invalid = Die E-Mailadresse ist nicht gueltig
+phone.invalid=Ihre Telefonnummer sollte aus Ziffern bestehen
+birthDay.invalid=Sie koennen nicht in der Zukunft Geburtstag haben
+birthDay.Required=Bitte geben Sie Ihr Geburtsdatum ein
+license.invalid=Leider koennen wir keine Lizenzen von Ebay akzeptieren
+license.unavailable=Sie brauchen schon eine Lizenz, um als Trainer zu arbeiten.
13 src/main/java/de/effectivetrainings/License.java
@@ -0,0 +1,13 @@
+package de.effectivetrainings;
+
+public enum License {
+ NONE,EBAY, CERTIFICATION;
+
+ public boolean isValid(){
+ return EBAY != this;
+ }
+
+ public boolean isAvailable(){
+ return NONE != this;
+ }
+}
24 src/main/java/de/effectivetrainings/LicenseAvailable.java
@@ -0,0 +1,24 @@
+package de.effectivetrainings;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+@Retention(RUNTIME)
+@Documented
+@Constraint(validatedBy = {LicenseAvailableValidator.class})
+public @interface LicenseAvailable {
+
+ String message() default "{de.effectivetrainings.LicenseAvailable.message}";
+
+ Class<?>[] groups() default { };
+
+ Class<? extends Payload>[] payload() default {};
+}
21 src/main/java/de/effectivetrainings/LicenseAvailableValidator.java
@@ -0,0 +1,21 @@
+package de.effectivetrainings;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author martindilger
+ * Date: 06.01.13
+ * Time: 17:21
+ */
+public class LicenseAvailableValidator implements ConstraintValidator<LicenseAvailable,License>{
+
+ @Override
+ public void initialize(LicenseAvailable constraintAnnotation) {
+ }
+
+ @Override
+ public boolean isValid(License license, ConstraintValidatorContext context) {
+ return license.isAvailable();
+ }
+}
26 src/main/java/de/effectivetrainings/LicenseValid.java
@@ -0,0 +1,26 @@
+package de.effectivetrainings;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+@Retention(RUNTIME)
+@Documented
+@Constraint(validatedBy = {LicenseValidator.class})
+public @interface LicenseValid {
+
+ String message() default "{de.effectivetrainings.LicenseValid.message}";
+
+ Class<?>[] groups() default { };
+
+ Class<? extends Payload>[] payload() default {};
+}
28 src/main/java/de/effectivetrainings/LicenseValidator.java
@@ -0,0 +1,28 @@
+package de.effectivetrainings;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author martindilger
+ * Date: 06.01.13
+ * Time: 17:21
+ */
+public class LicenseValidator implements ConstraintValidator<LicenseValid,License>{
+
+ @Override
+ public void initialize(LicenseValid constraintAnnotation) {
+ }
+
+ @Override
+ public boolean isValid(License license, ConstraintValidatorContext context) {
+ //external systems are so slow..
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ return false;
+ }
+ return license.isValid();
+
+ }
+}
9 src/main/java/de/effectivetrainings/SimpleValidations.java
@@ -0,0 +1,9 @@
+package de.effectivetrainings;
+
+/**
+ * @author martindilger
+ * Date: 06.01.13
+ * Time: 17:43
+ */
+public interface SimpleValidations {
+}
81 src/main/java/de/effectivetrainings/Trainer.java
@@ -0,0 +1,81 @@
+package de.effectivetrainings;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Past;
+import javax.validation.constraints.Pattern;
+import javax.validation.groups.Default;
+import java.io.Serializable;
+import java.util.Date;
+
+public class Trainer implements Serializable {
+
+ @NotNull
+ private String name;
+
+ @Pattern(message = "{email.invalid}",
+ regexp = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z]{2,}){1}$)")
+ @NotNull
+ private String email;
+
+ @Pattern(message = "{phone.invalid}",regexp = "[0-9]+")
+ private String phone;
+
+ @Past(message = "{birthDay.invalid}")
+ @NotNull
+ private Date birthDay;
+
+ @LicenseValid(message = "{license.invalid}",groups = ExtendedValidation.class)
+ @LicenseAvailable(message = "{license.unavailable}")
+ @NotNull
+ private License license;
+
+ public Trainer(String name, String email, String phone, Date birthDay) {
+ this.name = name;
+ this.email = email;
+ this.phone = phone;
+ this.birthDay = birthDay;
+ }
+
+ public Trainer(){}
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public Date getBirthDay() {
+ return birthDay;
+ }
+
+ public void setBirthDay(Date birthDay) {
+ this.birthDay = birthDay;
+ }
+
+ public License getLicense() {
+ return license;
+ }
+
+ public void setLicense(License license) {
+ this.license = license;
+ }
+}
13 src/main/java/de/effectivetrainings/TrainerGroupSequence.java
@@ -0,0 +1,13 @@
+package de.effectivetrainings;
+
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author martindilger
+ * Date: 06.01.13
+ * Time: 18:43
+ */
+@GroupSequence(value = {Default.class,ExtendedValidation.class})
+public interface TrainerGroupSequence {
+}
34 src/main/java/de/effectivetrainings/WicketApplication.java
@@ -0,0 +1,34 @@
+package de.effectivetrainings;
+
+import org.apache.wicket.bean.validation.BeanValidationConfiguration;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * Application object for your web application. If you want to run this application without deploying, run the Start class.
+ *
+ * @see de.effectivetrainings.Start#main(String[])
+ */
+public class WicketApplication extends WebApplication
+{
+ /**
+ * @see org.apache.wicket.Application#getHomePage()
+ */
+ @Override
+ public Class<? extends WebPage> getHomePage()
+ {
+ return HomePage.class;
+ }
+
+ /**
+ * @see org.apache.wicket.Application#init()
+ */
+ @Override
+ public void init()
+ {
+ super.init();
+ new BeanValidationConfiguration().configure(this);
+
+ // add your configuration here
+ }
+}
12 src/main/resources/log4j.properties
@@ -0,0 +1,12 @@
+log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
+
+log4j.rootLogger=INFO,Stdout
+
+log4j.logger.org.apache.wicket=INFO
+log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
+log4j.logger.org.apache.wicket.version=INFO
+log4j.logger.org.apache.wicket.RequestCycle=INFO
+
+
32 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <display-name>bean-validations</display-name>
+
+ <!--
+ There are three means to configure Wickets configuration mode and they
+ are tested in the order given.
+
+ 1) A system property: -Dwicket.configuration
+ 2) servlet specific <init-param>
+ 3) context specific <context-param>
+
+ The value might be either "development" (reloading when templates change) or
+ "deployment". If no configuration is found, "development" is the default. -->
+
+ <filter>
+ <filter-name>wicket.bean-validations</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>de.effectivetrainings.WicketApplication</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>wicket.bean-validations</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+</web-app>
BIN  src/main/webapp/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 src/main/webapp/style.css
@@ -0,0 +1,68 @@
+body, p, li, a { font-family: georgia, times, serif;font-size:13pt;}
+h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; }
+body { margin:0;padding:0;}
+#hd {
+ width : 100%;
+ height : 87px;
+ background-color : #092E67;
+ margin-top : 0;
+ padding-top : 10px;
+ border-bottom : 1px solid #888;
+ z-index : 0;
+}
+#ft {
+ position : absolute;
+ bottom : 0;
+ width : 100%;
+ height : 99px;
+ background-color : #6493D2;
+ border-top : 1px solid #888;
+ z-index : 0;
+}
+#logo,#bd {
+ width : 650px;
+ margin: 0 auto;
+ padding: 25px 50px 0 50px;
+}
+#logo h1 {
+ color : white;
+ font-size:36pt;
+ display: inline;
+}
+#logo img {
+ display:inline;
+ vertical-align: bottom;
+ margin-left : 50px;
+ margin-right : 5px;
+}
+body { margin-top : 0; padding-top : 0;}
+#logo, #logo h1 { margin-top : 0; padding-top : 0;}
+#bd {
+ position : absolute;
+ top : 75px;
+ bottom : 75px;
+ left : 50%;
+ margin-left : -325px;
+ z-index : 1;
+ overflow: auto;
+ background-color : #fff;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ -moz-box-shadow: 0px 0px 10px #888;
+ -webkit-box-shadow: 0px 0px 10px #888;
+ box-shadow: 0px 0px 10px #888;
+}
+a, a:visited, a:hover, a:active {
+ color : #6493D2;
+}
+h2 {
+ padding : 0; margin:0;
+ font-size:36pt;
+ color:#FF5500;
+}
+h3 {
+ padding : 0; margin:0;
+ font-size:24pt;
+ color:#092E67;
+}
76 src/test/java/de/effectivetrainings/Start.java
@@ -0,0 +1,76 @@
+package de.effectivetrainings;
+
+import org.apache.wicket.util.time.Duration;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.bio.SocketConnector;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+public class Start {
+ public static void main(String[] args) throws Exception {
+ int timeout = (int) Duration.ONE_HOUR.getMilliseconds();
+
+ Server server = new Server();
+ SocketConnector connector = new SocketConnector();
+
+ // Set some timeout options to make debugging easier.
+ connector.setMaxIdleTime(timeout);
+ connector.setSoLingerTime(-1);
+ connector.setPort(8080);
+ server.addConnector(connector);
+
+ Resource keystore = Resource.newClassPathResource("/keystore");
+ if (keystore != null && keystore.exists()) {
+ // if a keystore for a SSL certificate is available, start a SSL
+ // connector on port 8443.
+ // By default, the quickstart comes with a Apache Wicket Quickstart
+ // Certificate that expires about half way september 2021. Do not
+ // use this certificate anywhere important as the passwords are
+ // available in the source.
+
+ connector.setConfidentialPort(8443);
+
+ SslContextFactory factory = new SslContextFactory();
+ factory.setKeyStoreResource(keystore);
+ factory.setKeyStorePassword("wicket");
+ factory.setTrustStoreResource(keystore);
+ factory.setKeyManagerPassword("wicket");
+ SslSocketConnector sslConnector = new SslSocketConnector(factory);
+ sslConnector.setMaxIdleTime(timeout);
+ sslConnector.setPort(8443);
+ sslConnector.setAcceptors(4);
+ server.addConnector(sslConnector);
+
+ System.out.println("SSL access to the quickstart has been enabled on port 8443");
+ System.out.println("You can access the application using SSL on https://localhost:8443");
+ System.out.println();
+ }
+
+ WebAppContext bb = new WebAppContext();
+ bb.setServer(server);
+ bb.setContextPath("/");
+ bb.setWar("src/main/webapp");
+
+ // START JMX SERVER
+ // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
+ // server.getContainer().addEventListener(mBeanContainer);
+ // mBeanContainer.start();
+
+ server.setHandler(bb);
+
+ try {
+ System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
+ server.start();
+ System.in.read();
+ System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
+ server.stop();
+ server.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
BIN  src/test/resources/keystore
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.