001    package com.khubla.pragmatach.examples.sessionscopeexample;
002    
003    import com.khubla.pragmatach.framework.annotation.Controller;
004    import com.khubla.pragmatach.framework.annotation.Route;
005    import com.khubla.pragmatach.framework.annotation.View;
006    import com.khubla.pragmatach.framework.api.PragmatachException;
007    import com.khubla.pragmatach.framework.api.Response;
008    import com.khubla.pragmatach.plugin.freemarker.FreemarkerController;
009    
010    @Controller(name = "IndexController", scope = Controller.Scope.session)
011    @View(view = "index.ftl")
012    public class IndexController extends FreemarkerController {
013       private int requestCount = 0;
014    
015       public int getRequestCount() {
016          return requestCount;
017       }
018    
019       @Route(uri = "/")
020       public Response render() throws PragmatachException {
021          requestCount++;
022          return super.render();
023       }
024    
025       public void setRequestCount(int requestCount) {
026          this.requestCount = requestCount;
027       }
028    }