@@ -0,0 +1,2624 @@
+package com.github.avarabyeu.jashing;%0A%0Aimport com.github.avarabyeu.jashing.subscribers.ServerSentEventHandler;%0Aimport com.google.common.util.concurrent.AbstractIdleService;%0Aimport com.google.inject.Provider;%0Aimport freemarker.cache.ClassTemplateLoader;%0Aimport freemarker.template.Configuration;%0Aimport spark.Request;%0Aimport spark.Response;%0Aimport spark.Route;%0Aimport spark.Spark;%0Aimport spark.template.freemarker.FreeMarkerRoute;%0A%0Aimport java.io.IOException;%0Aimport java.util.Collections;%0A%0Aimport static spark.Spark.get;%0Aimport static spark.Spark.staticFileLocation;%0A%0A/**%0A * Created by andrey.vorobyov on 11/04/14.%0A */%0Apublic class JashingServer extends AbstractIdleService %7B%0A%0A%0A    private final int port;%0A    private final Provider%3CServerSentEventHandler%3E serverSentEventHandler;%0A%0A    public JashingServer(int port, Provider%3CServerSentEventHandler%3E serverSentEventHandler) %7B%0A        this.port = port;%0A        this.serverSentEventHandler = serverSentEventHandler;%0A    %7D%0A%0A    @Override%0A    protected void startUp() throws Exception %7B%0A        Spark.setPort(port);%0A        staticFileLocation(%22/statics%22);%0A%0A        get(new Route(%22/%22) %7B%0A            @Override%0A            public Object handle(Request request, Response response) %7B%0A                response.redirect(%22/sample%22);%0A                return response;%0A            %7D%0A        %7D);%0A%0A        get(new Route(%22/events%22) %7B%0A            @Override%0A            public Object handle(Request request, Response response) %7B%0A%0A                try %7B%0A                    serverSentEventHandler.get().handle(request, response);%0A                %7D catch (IOException e) %7B%0A                    return null;%0A                %7D%0A                return null;%0A            %7D%0A        %7D);%0A%0A        get(new Route(%22views/:widget%22) %7B%0A            @Override%0A            public Object handle(Request request, Response response) %7B%0A                response.redirect(%22/widgets/%22 + StringUtils.substringBefore(request.params(%22:widget%22), %22.html%22) + %22/%22 + request.params(%22:widget%22));%0A                return response;%0A            %7D%0A        %7D);%0A%0A        get(new FreeMarkerRoute(%22/:dashboard%22) %7B%0A            @Override%0A            public Object handle(Request request, Response response) %7B%0A                Configuration conf = new Configuration();%0A                conf.setTemplateLoader(new ClassTemplateLoader(Jashing.class, %22/%22));%0A                setConfiguration(conf);%0A                return modelAndView(Collections.EMPTY_MAP, %22/statics/assets/views/dashboards/%22 + request.params(%22:dashboard%22) + %22.ftl.html%22);%0A            %7D%0A        %7D);%0A%0A%0A    %7D%0A%0A%0A    @Override%0A    protected void shutDown() throws Exception %7B%0A%0A    %7D%0A%7D%0A

add light version based on spark