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
git clone https://github.com/altfatterz/atmosphere-fun | |
cd atmosphere-fun | |
mvn clean install | |
mvn jetty:run |
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 enum Event { | |
ACCOUNT_DEBITED, ACCOUNT_CREDITED, ACCOUNT_LOCKED | |
} |
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
<camelContext xmlns="http://camel.apache.org/schema/spring"> | |
<route> | |
<from uri="timer://foo?fixedRate=true&period=10s"/> | |
<process ref="accountBalanceProcessor" /> | |
<to uri="bean:atmospherePublishService?method=publish"/> | |
</route> | |
</camelContext> |
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
<servlet> | |
<description>AtmosphereServlet</description> | |
<servlet-name>AtmosphereServlet</servlet-name> | |
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class> | |
<!-- limit classpath scanning for ManagedService instances to speed up boostrapping --> | |
<init-param> | |
<param-name>org.atmosphere.cpr.packages</param-name> | |
<param-value>com.backbase.progfun.atmosphere</param-value> | |
</init-param> | |
<load-on-startup>0</load-on-startup> |
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
var request = { url: document.location.toString() + 'event', | |
contentType : "application/json", | |
logLevel : 'debug', | |
transport : 'websocket', | |
fallbackTransport : 'long-polling' , | |
trackMessageLength : true, | |
reconnectInterval : 5000, | |
enableXDR: true, | |
timeout : 60000, | |
headers : {sessionId : sessionId} // 0 for firefox, 1 for chrome, 2 for IE |
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
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.authorizeRequests() | |
.antMatchers("/signup", "/static/**").permitAll() | |
.antMatchers("/code").hasRole("PRE_AUTH_USER") | |
.antMatchers("/home").hasRole("USER") | |
.anyRequest().authenticated(); | |
http.formLogin() | |
.loginPage("/login") |
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 class UserDetailsServiceAdapter implements UserDetailsService { | |
@Autowired | |
private AccountRepository accountRepository; | |
@Override | |
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { | |
Account account = accountRepository.findByEmail(username); | |
if (account == null) { | |
throw new UsernameNotFoundException(username); |
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
@Configuration | |
@EnableCaching | |
@Profile("ehcache") | |
public class EhCacheConfiguration { | |
@Bean | |
EhCacheCacheManager ehCacheCacheManager() { | |
return new EhCacheCacheManager(ehCacheManagerFactoryBean().getObject()); | |
} |
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
@Configuration | |
@EnableCaching | |
@Profile("hazelcast") | |
public class HazelcastConfiguration { | |
@Bean | |
HazelcastCacheManager hazelcastcacheManager() throws Exception { | |
return new HazelcastCacheManager(hazelcastInstance()); | |
} |