001 package com.khubla.pragmatach.examples.jsonexample; 002 003 import java.util.Date; 004 005 import com.khubla.pragmatach.framework.annotation.Controller; 006 import com.khubla.pragmatach.framework.annotation.Route; 007 import com.khubla.pragmatach.framework.api.PragmatachException; 008 import com.khubla.pragmatach.framework.api.Response; 009 import com.khubla.pragmatach.plugin.json.JSONController; 010 011 @Controller() 012 public class IndexController extends JSONController { 013 /** 014 * the message 015 */ 016 private final String message = "hello world"; 017 /** 018 * the time 019 */ 020 private String time; 021 022 public String getMessage() { 023 return message; 024 } 025 026 public String getTime() { 027 return time; 028 } 029 030 @Route(uri = "/") 031 public Response render() throws PragmatachException { 032 time = new Date().toString(); 033 return super.render(); 034 } 035 036 public void setTime(String time) { 037 this.time = time; 038 } 039 }