001 package com.khubla.pragmatach.framework.controller.impl.trivial; 002 003 import com.khubla.pragmatach.framework.annotation.Controller; 004 import com.khubla.pragmatach.framework.api.PragmatachException; 005 import com.khubla.pragmatach.framework.api.Response; 006 import com.khubla.pragmatach.framework.controller.impl.AbstractController; 007 008 /** 009 * @author tome 010 */ 011 @Controller(name = "pragmatachTrivialController") 012 public class TrivialController extends AbstractController { 013 /** 014 * message 015 */ 016 private final String message; 017 /** 018 * code 019 */ 020 private final int httpCode; 021 022 public TrivialController(int httpCode) { 023 message = null; 024 this.httpCode = httpCode; 025 } 026 027 public TrivialController(String message, int httpCode) { 028 this.message = message; 029 this.httpCode = httpCode; 030 } 031 032 public Response render() throws PragmatachException { 033 return new TrivialResponse(getCacheHeaders(), message, httpCode); 034 } 035 }