Skip to content

Instantly share code, notes, and snippets.

View javaeeeee's full-sized avatar

Dmitry Noranovich javaeeeee

View GitHub Profile
@javaeeeee
javaeeeee / Dropwizard Custom Port Configuration
Created February 10, 2015 04:00
Dropwizard Custom Port Configuration
#Server configuration.
server:
applicationConnectors:
- type: http
port: 8085
@javaeeeee
javaeeeee / Create keystore using Java 8 keytool
Created February 10, 2015 04:03
Create keystore using Java 8 keytool
keytool -genkeypair
-keyalg RSA
-dname "CN=localhost"
-keystore dwstart.keystore
-keypass crimson
-storepass crimson
@javaeeeee
javaeeeee / Dropwizard HTTPS Configuration
Created February 10, 2015 04:04
Dropwizard HTTPS Configuration
#Server configuration.
server:
applicationConnectors:
- type: http
port: 8080
- type: https
port: 8443
keyStorePath: dwstart.keystore
keyStorePassword: crimson
validateCerts: false
@javaeeeee
javaeeeee / Dropwizard Integration Test
Created February 10, 2015 04:05
Dropwizard Integration Test
public class IntegrationTest {
@ClassRule
public static final DropwizardAppRule<DWGettingStartedConfiguration> RULE
= new DropwizardAppRule<>(DWGettingStartedApplication.class,
"config.yml");
@Test
public void testGetGreeting() {
String expected = "Hello world!";
@javaeeeee
javaeeeee / Dropwizard Integration Test using HTTPS, TLS
Created February 10, 2015 04:07
Dropwizard Integration Test using HTTPS/TLS and Jersey 2.x Client
//Create SSL Configurator
SslConfigurator sslConfigurator = SslConfigurator.newInstance();
//Register a keystore
sslConfigurator.trustStoreFile("dwstart.keystore")
.trustStorePassword("crimson");
//Create SSL Context
SSLContext sSLContext = sslConfigurator.createSSLContext();
//Obtain client
Client client = ClientBuilder
.newBuilder()
@javaeeeee
javaeeeee / HAL representation with properties
Created February 28, 2015 11:39
HAL representation with properties
{
"Title":"RESTful Web APIs",
"Price":"$31.92",
"Paperback":"408 pages",
"Language":"English"
}
@javaeeeee
javaeeeee / HAL representation with self link
Created February 28, 2015 11:40
HAL representation with self link
@javaeeeee
javaeeeee / HAL representation with custom relation type
Last active August 29, 2015 14:16
HAL representation with custom relation type
{
"_links":{
"self":{
"href":"/book/123"
},
"http://booklistapi.com/rels/authors":[
{
"href":"/author/4554",
"title":"Leonard Richardson"
},
@javaeeeee
javaeeeee / HAL representation with CURIE
Last active August 29, 2015 14:16
HAL representation with CURIE
{
"_links":{
"self":{
"href":"/book/123"
},
"curries":[
{
"name":"ns",
"href":"http://booklistapi.com/rels/{rel}",
"templated":true
@javaeeeee
javaeeeee / HAL representation with embedded objects
Created February 28, 2015 11:42
HAL representation with embedded objects
{
"_links":{
"self":{
"href":"/author/4554"
},
"curries":[
{
"name":"ns",
"href":"http://booklistapi.com/rels/{rel}",
"templated":true