RxJava – Observable.interval()

package rxjava;   import java.util.Random; import java.util.concurrent.TimeUnit;   import rx.Observable; import rx.Observer; import rx.functions.Func1; import rx.schedulers.Schedulers;   public class RxInterval {   private final Random random = new Random();   public RxInterval() {   Observable<Integer> observable = Observable .interval(5, TimeUnit.SECONDS) /** * startWith() * do Observable dodawany jest element startowy, który emitowy jest przed pierwszym Read more about RxJava – Observable.interval()[…]

Spring Annotation Based Single Class Web Application with JSP View Resolver

Works on Servlet 3.0+ containers. Better not mix Configuration classes with Controller classes. It is only for simplicity 😉 import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration;   import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView;   @Configuration @EnableWebMvc @Controller public Read more about Spring Annotation Based Single Class Web Application with JSP View Resolver[…]

Spring Annotation Based Single Class Web Application

Works on Servlet 3.0+ containers. Better not mix Configuration classes with Controller classes. It is only for simplicity 😉 import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration;   import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Controller; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.config.annotation.EnableWebMvc;   @Configuration @EnableWebMvc @Controller public class SpringWebApp implements WebApplicationInitializer {   @RequestMapping("/") @ResponseBody Read more about Spring Annotation Based Single Class Web Application[…]