ro.isdc.wro.extensions.http.handler
Class ModelAsJsonRequestHandler

java.lang.Object
  extended by ro.isdc.wro.http.handler.RequestHandlerSupport
      extended by ro.isdc.wro.extensions.http.handler.ModelAsJsonRequestHandler
All Implemented Interfaces:
RequestHandler

public class ModelAsJsonRequestHandler
extends RequestHandlerSupport

Expose the WroModel as JSON when the following uri is accessed: "wroAPI/model". This RequestHandler is useful to inspect the model and to simulate the behavior of the page when all resources are included (one by one) without being merged.

Since:
1.4.7
Author:
Alex Objelean, Ivar Conradi Ă˜sthus

Field Summary
static String ALIAS
          The alias of this RequestHandler used for configuration.
static String ENDPOINT_URI
          API - reload cache method call
 
Fields inherited from class ro.isdc.wro.http.handler.RequestHandlerSupport
PATH_API
 
Constructor Summary
ModelAsJsonRequestHandler()
           
 
Method Summary
 boolean accept(javax.servlet.http.HttpServletRequest request)
          Determines if current request can be handled by this requestHandler
 void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle the given request, generating a response.
 boolean isEnabled()
          Used to determine if the RequestHandler is enabled
protected  com.google.gson.Gson newGson(javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENDPOINT_URI

public static final String ENDPOINT_URI
API - reload cache method call

See Also:
Constant Field Values

ALIAS

public static final String ALIAS
The alias of this RequestHandler used for configuration.

See Also:
Constant Field Values
Constructor Detail

ModelAsJsonRequestHandler

public ModelAsJsonRequestHandler()
Method Detail

handle

public void handle(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws IOException
Handle the given request, generating a response.

Specified by:
handle in interface RequestHandler
Overrides:
handle in class RequestHandlerSupport
Parameters:
request - current HTTP request
response - current HTTP response
Throws:
IOException - in case of I/O errors

newGson

protected com.google.gson.Gson newGson(javax.servlet.http.HttpServletRequest request)
Returns:
customized Gson instance.

accept

public boolean accept(javax.servlet.http.HttpServletRequest request)
Determines if current request can be handled by this requestHandler

Specified by:
accept in interface RequestHandler
Overrides:
accept in class RequestHandlerSupport
Parameters:
request - current HTTP request
Returns:
true if this requestHandler should handle this request

isEnabled

public boolean isEnabled()
Used to determine if the RequestHandler is enabled

Specified by:
isEnabled in interface RequestHandler
Overrides:
isEnabled in class RequestHandlerSupport


Copyright © 2008-2013. All Rights Reserved.