org.modeshape.web.jcr.rest
Class QueryHandler

java.lang.Object
  extended by org.modeshape.web.jcr.rest.QueryHandler

@Immutable
public class QueryHandler
extends Object

Resource handler that implements REST methods for items.


Field Summary
protected static String BASE64_ENCODING_SUFFIX
           
static String EMPTY_REPOSITORY_NAME
          Name to be used when the repository name is empty string as "//" is not a valid path.
static String EMPTY_WORKSPACE_NAME
          Name to be used when the workspace name is empty string as "//" is not a valid path.
protected static UrlEncoder URL_ENCODER
           
 
Constructor Summary
QueryHandler()
           
 
Method Summary
protected  Session getSession(HttpServletRequest request, String rawRepositoryName, String rawWorkspaceName)
          Returns an active session for the given workspace name in the named repository.
protected  String jsonEncodedStringFor(Value value)
          Return the JSON-compatible string representation of the given property value.
 String postItem(HttpServletRequest request, String rawRepositoryName, String rawWorkspaceName, String language, String statement, long offset, long limit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE64_ENCODING_SUFFIX

protected static final String BASE64_ENCODING_SUFFIX
See Also:
Constant Field Values

URL_ENCODER

protected static final UrlEncoder URL_ENCODER

EMPTY_REPOSITORY_NAME

public static final String EMPTY_REPOSITORY_NAME
Name to be used when the repository name is empty string as "//" is not a valid path.

See Also:
Constant Field Values

EMPTY_WORKSPACE_NAME

public static final String EMPTY_WORKSPACE_NAME
Name to be used when the workspace name is empty string as "//" is not a valid path.

See Also:
Constant Field Values
Constructor Detail

QueryHandler

public QueryHandler()
Method Detail

postItem

public String postItem(HttpServletRequest request,
                       String rawRepositoryName,
                       String rawWorkspaceName,
                       String language,
                       String statement,
                       long offset,
                       long limit)
                throws RepositoryException,
                       org.codehaus.jettison.json.JSONException
Throws:
RepositoryException
org.codehaus.jettison.json.JSONException

getSession

protected Session getSession(HttpServletRequest request,
                             String rawRepositoryName,
                             String rawWorkspaceName)
                      throws RepositoryException
Returns an active session for the given workspace name in the named repository.

Parameters:
request - the servlet request; may not be null or unauthenticated
rawRepositoryName - the URL-encoded name of the repository in which the session is created
rawWorkspaceName - the URL-encoded name of the workspace to which the session should be connected
Returns:
an active session with the given workspace in the named repository
Throws:
RepositoryException - if any other error occurs

jsonEncodedStringFor

protected String jsonEncodedStringFor(Value value)
                               throws RepositoryException
Return the JSON-compatible string representation of the given property value. If the value is a binary value, then this method returns the Base-64 encoding of that value. Otherwise, it just returns the string representation of the value.

Parameters:
value - the property value; may not be null
Returns:
the string representation of the value
Throws:
RepositoryException - if there is a problem accessing the value


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.