org.apache.sling.servlets.get.impl
Class JsonQueryServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by org.apache.sling.api.servlets.SlingSafeMethodsServlet
          extended by org.apache.sling.servlets.get.impl.JsonQueryServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JsonQueryServlet
extends SlingSafeMethodsServlet

A SlingSafeMethodsServlet that renders the search results as JSON data

See Also:
Serialized Form

Field Summary
static String EXCERPT_PATH
          exerpt lookup path
static String OFFSET
          Result set offset
static String PROPERTY
          property to append to the result
static String QUERY_TYPE
          Query type
static String ROWS
          Number of rows requested
static String STATEMENT
          Search clause
static String TIDY
           
 
Constructor Summary
JsonQueryServlet()
           
 
Method Summary
protected  void doGet(SlingHttpServletRequest req, SlingHttpServletResponse resp)
          Called by the SlingSafeMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to handle an HTTP GET request.
protected  String getQueryType(SlingHttpServletRequest req)
          Retrieve the query type from the request.
protected  String getStatement(SlingHttpServletRequest req, String queryType)
          Retrieve the query statement from the request.
protected  boolean isTidy(SlingHttpServletRequest req)
          True if our request wants the "tidy" pretty-printed format
 
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doHead, doOptions, doTrace, getAllowedRequestMethods, getServletInfo, handleMethodNotImplemented, mayService, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATEMENT

public static final String STATEMENT
Search clause

See Also:
Constant Field Values

QUERY_TYPE

public static final String QUERY_TYPE
Query type

See Also:
Constant Field Values

OFFSET

public static final String OFFSET
Result set offset

See Also:
Constant Field Values

ROWS

public static final String ROWS
Number of rows requested

See Also:
Constant Field Values

PROPERTY

public static final String PROPERTY
property to append to the result

See Also:
Constant Field Values

EXCERPT_PATH

public static final String EXCERPT_PATH
exerpt lookup path

See Also:
Constant Field Values

TIDY

public static final String TIDY
See Also:
Constant Field Values
Constructor Detail

JsonQueryServlet

public JsonQueryServlet()
Method Detail

isTidy

protected boolean isTidy(SlingHttpServletRequest req)
True if our request wants the "tidy" pretty-printed format


doGet

protected void doGet(SlingHttpServletRequest req,
                     SlingHttpServletResponse resp)
              throws IOException
Description copied from class: SlingSafeMethodsServlet
Called by the SlingSafeMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to handle an HTTP GET request.

This default implementation reports back to the client that the method is not supported.

Implementations of this class should overwrite this method with their implementation for the HTTP GET method support.

Overrides:
doGet in class SlingSafeMethodsServlet
Parameters:
req - The HTTP request
resp - The HTTP response
Throws:
IOException - If the error status cannot be reported back to the client.

getQueryType

protected String getQueryType(SlingHttpServletRequest req)
Retrieve the query type from the request.

Parameters:
req - request
Returns:
the query type.

getStatement

protected String getStatement(SlingHttpServletRequest req,
                              String queryType)
Retrieve the query statement from the request.

Parameters:
req - request
queryType - the query type, as previously determined
Returns:
the query statement.


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.