Skip to content

Instantly share code, notes, and snippets.

@frow
frow / express-ws-proxy.ts
Last active August 13, 2019 17:01
express + express.ws + node-http-proxy
import * as httpProxy from 'http-proxy';
import * as express from 'express';
import * as expressWs from 'express-ws';
import * as WebSocket from 'ws';
import * as cookieParser from 'cookie-parser';
const proxy = httpProxy.createProxyServer({
});
const httpServer = express();
/**
* A reader which is used to read polymorphic associations.
* Implementors have to provide a getPolyModel function.
*/
Ext.define('Your.PolymorphicReader', {
extend : 'Ext.data.reader.Json',
extractData : function(root) {
var me = this, values = [], records = [], tempModel, i = 0, length = root.length, node, id, record;
if(!root.length && Ext.isObject(root)) {
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<jpa:repositories base-package="de.celonis.pbi.core.repositories" />
<jpa:repositories base-package="de.celonis.pbi.plugins.*.repositories" />
</beans>
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:persistence.properties")
@ComponentScan(basePackages = { "com.github.plugspring.core.domain",
"com.github.plugspring.plugins.*.domain" })
@ImportResource(value = "classpath:persistence-context.xml")
public class PersistenceConfig implements TransactionManagementConfigurer {
// blah
@Configuration
@Import({ PersistenceConfig.class })
public class RootConfig {
}
@frow
frow / WebAppInitializer.java
Created May 18, 2012 21:33
The Web App Initializer
public class WebAppInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(RootConfig.class);
servletContext.addListener(new ContextLoaderListener(rootContext));