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
//in Application.java | |
@Bean | |
public EmbeddedServletContainerFactory servletContainer() { | |
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); | |
tomcat.setProtocol("org.apache.coyote.http11.Http11Nio2Protocol"); | |
tomcat.addContextCustomizers((context) -> { | |
StandardRoot standardRoot = new StandardRoot(context); | |
standardRoot.setCacheMaxSize(64 * 1024); |
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
// reference: http://www.baeldung.com/spring-async , http://javasampleapproach.com/java-integration/start-spring-async-spring-boot | |
... | |
//in ExecutorConfig.java | |
@Configuration | |
@EnableAsync | |
public class AsyncConfiguration { | |
@Bean(name = "myAsyncExecutor") | |
public Executor asyncExecutor() { |
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
import os, sys, requests, json, argparse | |
if __name__=='__main__': | |
fileName = os.path.basename(__file__) | |
parser = argparse.ArgumentParser(description='Monitor a spring boot healthcheck.', | |
epilog='Examples: "' + fileName + ' -i localhost:8080 -s myService" OR "'+fileName+' -i myhost.example.com:8001"') | |
parser.add_argument('-i', '--host', help="The hostname or hostname:port portion of the service)", required=True) | |
parser.add_argument('-t', '--https', help="Turn on SSL (use HTTPS instead of HTTP)", action='store_true', default=False) | |
parser.add_argument('-s', '--service', help="The case-sensitive name of the service for including the service-specific section inside the health check response", required=False) |
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
# | |
#1. Add an ACL for the top level routes you need to proxy | |
# | |
acl routes_to_proxy path_beg -i /my/path /other-path | |
# | |
#2. Associate the routes with a backend | |
# | |
use_backend my_backend if routes_to_proxy | |
# | |
#3. Create a list of credentials (note: passwords are in clear text. this is bad security practice.) |
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
public abstract class AbstractJackson2MarshallingTest { | |
protected ObjectMapper mapper; | |
@Before | |
public void setUp() { | |
mapper = new ObjectMapper(); | |
mapper.enable(SerializationFeature.INDENT_OUTPUT); | |
} |
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
# tested with Python 2.7.5 | |
import json | |
import urllib2 | |
api_url = "http://jsonplaceholder.typicode.com/users" | |
# API below returns an array of complex JSON objects | |
jsonobj = json.load(urllib2.urlopen(api_url)) | |
# index into the array and access a sub-attribute like this: |