-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
401 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# javaServletMirror | ||
.. to see your request; | ||
HTTP Mirror or feedback page | ||
|
||
 | ||
|
||
## DEV | ||
|
||
To generate Keystore/Truststore file: | ||
``` | ||
rm jetty.keystore | ||
keytool -genkey -alias jetty -keyalg RSA -keystore jetty.keystore -storepass secret \ | ||
-keypass secret -dname "CN=localhost, ou=DEV, o=Dev404, st=Lj., c=SI" \ | ||
-validity 3650 -ext SAN=dns:localhost | ||
``` | ||
|
||
The file(-s) are also available on: | ||
> https://cloud.dev404.net/index.php/s/HYspJem8aaHZbJN | ||
.. in the Map: cert02/ | ||
|
||
|
||
### Test - local | ||
|
||
Mirror page: | ||
``` | ||
curl -i http://localhost:11080 | ||
curl -i http://localhost:11080/mirror/ | ||
curl -i http://localhost:11080/mirror/v1 | ||
curl -i --insecure https://localhost:11443/mirror/v1 | ||
``` | ||
|
||
Monitor page: | ||
``` | ||
curl -i http://localhost:11080/mirror/monitor/v1 | ||
``` | ||
|
||
|
||
## Sample | ||
|
||
URL: | ||
* https://storitve.ezdrav.si/servis/preveriDostopnost | ||
* https://euez-test.ezdrav.si/servis/preveriDostopnost | ||
|
||
|
||
## Reference | ||
|
||
* http://juplo.de/configure-https-for-jetty-maven-plugin-9-0-x/ | ||
* ---- | ||
* https://webhook.site/ | ||
* https://hookbin.com/ | ||
* https://requestbin.fullcontact.com/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> | ||
<!-- ============================================================= --> | ||
<!-- Configure the Jetty Server instance with an ID "Server" --> | ||
<!-- by adding a HTTP connector. --> | ||
<!-- This configuration must be used in conjunction with jetty.xml --> | ||
<!-- ============================================================= --> | ||
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | ||
<!-- =========================================================== --> | ||
<!-- Add a HTTP Connector. --> | ||
<!-- Configure an o.e.j.server.ServerConnector with a single --> | ||
<!-- HttpConnectionFactory instance using the common httpConfig --> | ||
<!-- instance defined in jetty.xml --> | ||
<!-- --> | ||
<!-- Consult the javadoc of o.e.j.server.ServerConnector and --> | ||
<!-- o.e.j.server.HttpConnectionFactory for all configuration --> | ||
<!-- that may be set here. --> | ||
<!-- =========================================================== --> | ||
<Call name="addConnector"> | ||
<Arg> | ||
<New class="org.eclipse.jetty.server.ServerConnector"> | ||
<Arg name="server"><Ref refid="Server" /></Arg> | ||
<Arg name="factories"> | ||
<Array type="org.eclipse.jetty.server.ConnectionFactory"> | ||
<Item> | ||
<New class="org.eclipse.jetty.server.HttpConnectionFactory"> | ||
<Arg name="config"><Ref refid="httpConfig" /></Arg> | ||
</New> | ||
</Item> | ||
</Array> | ||
</Arg> | ||
<Set name="host"><Property name="jetty.host" /></Set> | ||
<Set name="port"><Property name="jetty.port" default="11080" /></Set> | ||
<Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set> | ||
</New> | ||
</Arg> | ||
</Call> | ||
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> | ||
<!-- ============================================================= --> | ||
<!-- Configure a HTTPS connector. --> | ||
<!-- This configuration must be used in conjunction with jetty.xml --> | ||
<!-- and jetty-ssl.xml. --> | ||
<!-- ============================================================= --> | ||
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | ||
<!-- =========================================================== --> | ||
<!-- Add a HTTPS Connector. --> | ||
<!-- Configure an o.e.j.server.ServerConnector with connection --> | ||
<!-- factories for TLS (aka SSL) and HTTP to provide HTTPS. --> | ||
<!-- All accepted TLS connections are wired to a HTTP connection.--> | ||
<!-- --> | ||
<!-- Consult the javadoc of o.e.j.server.ServerConnector, --> | ||
<!-- o.e.j.server.SslConnectionFactory and --> | ||
<!-- o.e.j.server.HttpConnectionFactory for all configuration --> | ||
<!-- that may be set here. --> | ||
<!-- =========================================================== --> | ||
<Call id="httpsConnector" name="addConnector"> | ||
<Arg> | ||
<New class="org.eclipse.jetty.server.ServerConnector"> | ||
<Arg name="server"><Ref refid="Server" /></Arg> | ||
<Arg name="factories"> | ||
<Array type="org.eclipse.jetty.server.ConnectionFactory"> | ||
<Item> | ||
<New class="org.eclipse.jetty.server.SslConnectionFactory"> | ||
<Arg name="next">http/1.1</Arg> | ||
<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg> | ||
</New> | ||
</Item> | ||
<Item> | ||
<New class="org.eclipse.jetty.server.HttpConnectionFactory"> | ||
<Arg name="config"><Ref refid="sslHttpConfig"/></Arg> | ||
</New> | ||
</Item> | ||
</Array> | ||
</Arg> | ||
<Set name="host"><Property name="jetty.host" /></Set> | ||
<Set name="port"><Property name="https.port" default="11443" /></Set> | ||
<Set name="idleTimeout"><Property name="https.timeout" default="30000"/></Set> | ||
</New> | ||
</Arg> | ||
</Call> | ||
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> | ||
<!-- ============================================================= --> | ||
<!-- Configure a TLS (SSL) Context Factory --> | ||
<!-- This configuration must be used in conjunction with jetty.xml --> | ||
<!-- and either jetty-https.xml or jetty-spdy.xml (but not both) --> | ||
<!-- ============================================================= --> | ||
<Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"> | ||
<Set name="KeyStorePath"> | ||
<Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="localhost.jks"/> | ||
</Set> | ||
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="secret"/></Set> | ||
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="secret"/></Set> | ||
<Set name="TrustStorePath"> | ||
<Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="cacerts-si.jks"/> | ||
</Set> | ||
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="secret"/></Set> | ||
<Set name="EndpointIdentificationAlgorithm"></Set> | ||
<Set name="NeedClientAuth"> | ||
<Property name="jetty.needclientauth" default="false"/> | ||
</Set> | ||
<Set name="ExcludeCipherSuites"> | ||
<Array type="String"> | ||
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item> | ||
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item> | ||
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item> | ||
<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item> | ||
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item> | ||
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item> | ||
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item> | ||
</Array> | ||
</Set> | ||
<!-- =========================================================== --> | ||
<!-- Create a TLS specific HttpConfiguration based on the --> | ||
<!-- common HttpConfiguration defined in jetty.xml --> | ||
<!-- Add a SecureRequestCustomizer to extract certificate and --> | ||
<!-- session information --> | ||
<!-- =========================================================== --> | ||
<New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration"> | ||
<Arg><Ref refid="httpConfig"/></Arg> | ||
<Call name="addCustomizer"> | ||
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg> | ||
</Call> | ||
</New> | ||
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> | ||
<!-- ============================================================= --> | ||
<!-- Configure the Http Configuration --> | ||
<!-- ============================================================= --> | ||
<Configure id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration"> | ||
<Set name="secureScheme">https</Set> | ||
<Set name="securePort"><Property name="jetty.secure.port" default="11443" /></Set> | ||
<Set name="outputBufferSize">32768</Set> | ||
<Set name="requestHeaderSize">8192</Set> | ||
<Set name="responseHeaderSize">8192</Set> | ||
<Set name="sendServerVersion">true</Set> | ||
<Set name="sendDateHeader">true</Set> | ||
<Set name="headerCacheSize">512</Set> | ||
<!-- Uncomment to enable handling of X-Forwarded- style headers | ||
<Call name="addCustomizer"> | ||
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg> | ||
</Call> | ||
--> | ||
</Configure> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<project> | ||
<!-- model version is always 4.0.0 for Maven 2.x POMs --> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- project coordinates.. --> | ||
<groupId>com.stupica.base</groupId> | ||
<artifactId>servletMirror</artifactId> | ||
<version>1.0.1</version> | ||
<packaging>war</packaging> | ||
<name>servletMirror</name> | ||
<organization> | ||
<name>developer.stupica.com</name> | ||
<url>http://www.stupica.com</url> | ||
</organization> | ||
<url>http://developer.stupica.com/maven</url> | ||
|
||
<properties> | ||
<java-version>1.8</java-version> | ||
<maven.compiler.source>${java-version}</maven.compiler.source> | ||
<maven.compiler.target>${java-version}</maven.compiler.target> | ||
|
||
<version.jetty>9.4.19.v20190610</version.jetty> | ||
</properties> | ||
|
||
<!-- library dependencies --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.stupica.base</groupId> | ||
<artifactId>servletCore</artifactId> | ||
<version>[1.9,2)</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- | ||
<finalName>servletMirror</finalName> | ||
--> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.2.3</version> | ||
<configuration> | ||
<archive> | ||
<!-- | ||
<manifestFile>src/main/webapp/META-INF/MANIFEST.MF</manifestFile> | ||
--> | ||
<manifestEntries> | ||
<Implementation-Version>${project.version}</Implementation-Version> | ||
<Specification-Version>${project.version}</Specification-Version> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>${version.jetty}</version> | ||
<configuration> | ||
<jettyXml> | ||
${project.basedir}/jetty.xml,${project.basedir}/jetty-ssl.xml,${project.basedir}/jetty-https.xml | ||
</jettyXml> | ||
<!-- | ||
<jettyXml> | ||
${project.basedir}/jetty.xml,${project.basedir}/jetty-http.xml,${project.basedir}/jetty-ssl.xml,${project.basedir}/jetty-https.xml | ||
</jettyXml> | ||
--> | ||
<scanIntervalSeconds>11</scanIntervalSeconds> | ||
<webApp> | ||
<contextPath>/mirror</contextPath> | ||
</webApp> | ||
<httpConnector> | ||
<port>11080</port> | ||
</httpConnector> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<developers> | ||
<developer> | ||
<id>bostjanst</id> | ||
<name>Bostjan Stupica</name> | ||
<email>[email protected]</email> | ||
<url>http://www.stupica.com</url> | ||
<organization>Developer404</organization> | ||
<organizationUrl>http://www.stupica.com</organizationUrl> | ||
<roles> | ||
<role>architect</role> | ||
<role>developer</role> | ||
<role>admin</role> | ||
</roles> | ||
<timezone>Europe/Ljubljana</timezone> | ||
<properties> | ||
<picUrl>http://bostjan.dev404.net/about_me/myimg01.jpg</picUrl> | ||
</properties> | ||
</developer> | ||
</developers> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app version="2.5" 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"> | ||
<!-- ========================================================== --> | ||
<!-- General --> | ||
<!-- Resource: --> | ||
<!-- o http://wiki.metawerx.net/wiki/Web.xml --> | ||
<!-- ========================================================== --> | ||
|
||
<!-- Name the application --> | ||
<display-name>servletMirrorApp</display-name> | ||
<description>Servlet Mirror WebApp - InterFac</description> | ||
|
||
<!-- ========================================================== --> | ||
<!-- Servlets --> | ||
<!-- ========================================================== --> | ||
<servlet> | ||
<servlet-name>mirrorMonitor01Servlet</servlet-name> | ||
<servlet-class>com.stupica.servlet.http.Monitor</servlet-class> | ||
<load-on-startup>1</load-on-startup> | ||
<!-- | ||
<description>Lenko REST service for ..</description> | ||
--> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>mirrorMonitor01Servlet</servlet-name> | ||
<url-pattern>/monitor/v1/*</url-pattern> | ||
</servlet-mapping> | ||
|
||
<servlet> | ||
<servlet-name>mirror01Servlet</servlet-name> | ||
<servlet-class>com.stupica.servlet.http.Mirror</servlet-class> | ||
<load-on-startup>1</load-on-startup> | ||
<!-- | ||
<description>Lenko REST service for ..</description> | ||
--> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>mirror01Servlet</servlet-name> | ||
<url-pattern>/v1/*</url-pattern> | ||
</servlet-mapping> | ||
|
||
<session-config> | ||
<session-timeout>1</session-timeout> | ||
</session-config> | ||
|
||
|
||
<!-- ========================================================== --> | ||
<!-- JNDI Environment Variables --> | ||
<!-- ========================================================== --> | ||
<!-- | ||
<env-entry> | ||
<env-entry-name>JDBC_TYPE</env-entry-name> | ||
<env-entry-type>java.lang.String</env-entry-type> | ||
<env-entry-value>MySQL</env-entry-value> | ||
</env-entry> | ||
--> | ||
|
||
|
||
<!-- ========================================================== --> | ||
<!-- Welcome Files --> | ||
<!-- ========================================================== --> | ||
|
||
<!-- Define, in order of preference, which file to show when no filename is defined in the path --> | ||
<!-- eg: when user goes to http://yoursite.com/ or http://yoursite.com/somefolder --> | ||
<!-- Defaults are provided in the server-wide web.xml file, such as index.jsp, index.htm --> | ||
<!-- Note: using this tag overrides the defaults, so don't forget to add them here --> | ||
<welcome-file-list> | ||
<welcome-file>index.html</welcome-file> | ||
<welcome-file>index.htm</welcome-file> | ||
<welcome-file>index.jsp</welcome-file> | ||
</welcome-file-list> | ||
|
||
|
||
<security-constraint> | ||
<web-resource-collection> | ||
<web-resource-name>Secure resources</web-resource-name> | ||
<url-pattern>/v1/*</url-pattern> | ||
</web-resource-collection> | ||
<user-data-constraint> | ||
<transport-guarantee>CONFIDENTIAL</transport-guarantee> | ||
</user-data-constraint> | ||
</security-constraint> | ||
<!-- | ||
<url-pattern>/docInv/v1/*</url-pattern> | ||
<filter-pattern>*</filter-pattern> | ||
--> | ||
</web-app> |
Oops, something went wrong.