Skip to content

Instantly share code, notes, and snippets.

View stephen-masters's full-sized avatar

Stephen Masters stephen-masters

View GitHub Profile
@stephen-masters
stephen-masters / ServletUriComponentsBuilder fixes
Last active August 29, 2015 14:02
Spring Framework servlet request parsing bug
/**
* Prepare a builder by copying the scheme, host, port, path, and
* query string of an HttpServletRequest.
*/
public static CorrectedServletUriComponentsBuilder fromRequest(HttpServletRequest request) {
String scheme = scheme(request);
String host = host(request);
int port = port(request);
@stephen-masters
stephen-masters / spring-platform-bom.xml
Last active August 29, 2015 14:14
Spring IO Platform BOM
<!-- Transitively bring in the Spring IO Platform Bill-of-Materials `pom.xml` -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.1.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@stephen-masters
stephen-masters / kmodule.xml
Created February 6, 2015 12:55
Example kmodule.xml
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<kbase name="BusPassKbase" packages="com.sctrcd.buspassws.rules">
<ksession name="BusPassSession" />
</kbase>
</kmodule>
@stephen-masters
stephen-masters / gist:e246df0650984490e7be
Created February 6, 2015 13:01
Get a KieContainer and create a KieSession
KieContainer kieContainer = KieServices.Factory.get().getKieClasspathContainer();
KieSession kieSession = kieContainer.newKieSession("BusPassSession");
@SpringBootApplication
public class BusPassApp {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(BusPassApp.class, args);
}
@Bean
public KieContainer kieContainer() {
return KieServices.Factory.get().getKieClasspathContainer();
@Service
public class BusPassService {
private final KieContainer kieContainer;
@Autowired
public BusPassService(KieContainer kieContainer) {
log.info("Initialising a new bus pass session.");
this.kieContainer = kieContainer;
}
@RestController
public class BusPassController {
private static Logger log = LoggerFactory.getLogger(BusPassController.class);
private final BusPassService busPassService;
@Autowired
public BusPassController(BusPassService busPassService) {
this.busPassService = busPassService;
bea_home=/path/to/bea
java_home=/path/to/bea/jdk160_18
domain_template=/path/to/bea/weblogic11/common/templates/domains/wls.jar
admin_server_name=my_admin_server
admin_url=t3\://myserver\:7001
admin_user=weblogic
admin_password=w3blogicpwd
admin_port=7001
@stephen-masters
stephen-masters / gist:767747
Created January 6, 2011 10:36
WebLogic - Get JMS server stats
# ----------------------------------------------------------------------
# Example of connecting to a running JMS server and getting stats.
# ----------------------------------------------------------------------
import java.lang.Thread
def get_messaging_stats():
print 'Searching for JMS connections...'
# Hard-codes the JMS server name. You will probably want to parameterize this.
@stephen-masters
stephen-masters / gist:767740
Created January 6, 2011 10:28
WebLogic - Get connection pool sizes
# --------------------------------------------------
# Use WLST to connect to running WebLogic application servers and
# output a list of database connection pools and their sizes.
#
# This can be used for health monitoring and to support tuning.
# --------------------------------------------------
import java.lang.Thread
def get_connection_pool_sizes():