Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Masters gratiartis

View GitHub Profile
@gratiartis
gratiartis / ServletUriComponentsBuilder fixes
Last active Aug 29, 2015
Spring Framework servlet request parsing bug
View ServletUriComponentsBuilder fixes
/**
* 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);
@gratiartis
gratiartis / spring-platform-bom.xml
Last active Aug 29, 2015
Spring IO Platform BOM
View spring-platform-bom.xml
<!-- 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>
View BusPassApp.java
@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();
@gratiartis
gratiartis / kmodule.xml
Created Feb 6, 2015
Example kmodule.xml
View 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>
View BusPassController.java
@RestController
public class BusPassController {
private static Logger log = LoggerFactory.getLogger(BusPassController.class);
private final BusPassService busPassService;
@Autowired
public BusPassController(BusPassService busPassService) {
this.busPassService = busPassService;
View BusPassService.java
@Service
public class BusPassService {
private final KieContainer kieContainer;
@Autowired
public BusPassService(KieContainer kieContainer) {
log.info("Initialising a new bus pass session.");
this.kieContainer = kieContainer;
}
@gratiartis
gratiartis / gist:e246df0650984490e7be
Created Feb 6, 2015
Get a KieContainer and create a KieSession
View gist:e246df0650984490e7be
KieContainer kieContainer = KieServices.Factory.get().getKieClasspathContainer();
KieSession kieSession = kieContainer.newKieSession("BusPassSession");
View config.properties
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
@gratiartis
gratiartis / gist:767747
Created Jan 6, 2011
WebLogic - Get JMS server stats
View gist:767747
# ----------------------------------------------------------------------
# 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.
@gratiartis
gratiartis / gist:767740
Created Jan 6, 2011
WebLogic - Get connection pool sizes
View gist:767740
# --------------------------------------------------
# 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():