com.khubla.pragmatach.framework.controller.impl
Class AbstractController

java.lang.Object
  extended by com.khubla.pragmatach.framework.controller.impl.AbstractController
All Implemented Interfaces:
PragmatachController
Direct Known Subclasses:
AbstractStreamingController, AbstractTemplateEngineController, AdminUserController, DefaultContextRootController, ExampleClusteredController, JacksonController, JSONController, RedirectController, ServerInstanceController, SimpleTemplateController, StaticResourceController, TrivialController, XStreamController, YAMLController

public abstract class AbstractController
extends Object
implements PragmatachController

Author:
tome

Constructor Summary
AbstractController()
           
 
Method Summary
 Response bad()
          bad; HTTP 400
static String buildWildcardResourceURI(String[] resource)
          build a path from a wildcard path
 Response forward(String uri)
          forward to another controller uri
 String getApplicationURL()
          get the base URI of this application
protected  Map<String,String> getCacheHeaders()
          generate the cache headers
 String getConfigurationParameter(String name)
          get a configuration parameter from the pragmatatch configuration
static String getControllerName(Class<?> clazz)
          get the name of the controller from the annotation
static String getControllerName(PragmatachController pragmatachController)
          get the name of the controller from the annotation
 PragmatachRoute getPragmatachRoute()
           
 Request getRequest()
          get the request
protected  InputStream getResource(String resource)
          get a resource using the servlet's class loader
<T> T
getSessionScopedController(Class<T> clazz)
          get the instance of a session-bound controller
 Response ok()
          ok; HTTP 200
 Response redirect(String uri)
          redirect.
 void setPragmatachRoute(PragmatachRoute pragmatachRoute)
          set the Route this is being invoked on
 void setRequest(Request request)
          set the request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractController

public AbstractController()
Method Detail

buildWildcardResourceURI

public static String buildWildcardResourceURI(String[] resource)
build a path from a wildcard path


getControllerName

public static String getControllerName(Class<?> clazz)
get the name of the controller from the annotation


getControllerName

public static String getControllerName(PragmatachController pragmatachController)
get the name of the controller from the annotation


bad

public Response bad()
             throws PragmatachException
bad; HTTP 400

Throws:
PragmatachException

forward

public Response forward(String uri)
                 throws PragmatachException
forward to another controller uri

Throws:
PragmatachException

getApplicationURL

public String getApplicationURL()
get the base URI of this application


getCacheHeaders

protected Map<String,String> getCacheHeaders()
                                      throws PragmatachException
generate the cache headers

Throws:
PragmatachException

getConfigurationParameter

public String getConfigurationParameter(String name)
                                 throws PragmatachException
get a configuration parameter from the pragmatatch configuration

Throws:
PragmatachException

getPragmatachRoute

public PragmatachRoute getPragmatachRoute()

getRequest

public Request getRequest()
get the request


getResource

protected InputStream getResource(String resource)
                           throws PragmatachException
get a resource using the servlet's class loader

Throws:
PragmatachException

getSessionScopedController

public <T> T getSessionScopedController(Class<T> clazz)
get the instance of a session-bound controller


ok

public Response ok()
            throws PragmatachException
ok; HTTP 200

Throws:
PragmatachException

redirect

public Response redirect(String uri)
                  throws PragmatachException
redirect. This API requires a full URL including authority, hostname, port, etc.

Throws:
PragmatachException

setPragmatachRoute

public void setPragmatachRoute(PragmatachRoute pragmatachRoute)
Description copied from interface: PragmatachController
set the Route this is being invoked on

Specified by:
setPragmatachRoute in interface PragmatachController

setRequest

public void setRequest(Request request)
set the request

Specified by:
setRequest in interface PragmatachController


Copyright © 2014 khubla.com. All rights reserved.