Class PackageServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- org.apache.sling.api.servlets.SlingAllMethodsServlet
-
- com.composum.sling.core.servlet.AbstractServiceServlet
-
- com.composum.sling.core.pckgmgr.jcrpckg.PackageServlet
-
- All Implemented Interfaces:
RestrictedService
,Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class PackageServlet extends AbstractServiceServlet
The servlet to provide download and upload of content packages and package definitions.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static boolean
AUTO_SAVE
protected PackageServlet.PackageOperationSet
operations
static String
PARAM_FORCE
static String
PARAM_GROUP
static String
PARAM_MERGED
Has value "merged" in some cases if it's important whether we are in registry merged mode or not.static String
PARAM_REGISTRY
The key (namespace) of the PackageRegistry,PackageRegistries.Registries.getNamespaces()
.static String
SERVICE_KEY
static String
SERVLET_PATH
static String
ZIP_CONTENT_TYPE
-
Fields inherited from class com.composum.sling.core.servlet.AbstractServiceServlet
DATE_FORMAT, PARAM_BEFORE, PARAM_CMD, PARAM_FILE, PARAM_FILTER, PARAM_ID, PARAM_INDEX, PARAM_JCR_CONTENT, PARAM_LABEL, PARAM_MIME_TYPE, PARAM_NAME, PARAM_PATH, PARAM_QUERY, PARAM_RESOURCE_TYPE, PARAM_TITLE, PARAM_TYPE, PARAM_URL, PARAM_VALUE, PARAM_VERSION
-
-
Constructor Summary
Constructors Constructor Description PackageServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(org.osgi.framework.BundleContext bundleContext, PackageServlet.Configuration configuration)
protected static void
fromJson(com.google.gson.stream.JsonReader reader, org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage)
protected static void
fromJson(com.google.gson.stream.JsonReader reader, org.apache.jackrabbit.vault.packaging.JcrPackageDefinition definition)
protected List<String>
getArrayParameter(org.apache.sling.api.request.RequestParameterMap parameters, String parameterName)
protected String
getGroup(org.apache.sling.api.request.RequestParameterMap parameters)
protected String
getName(org.apache.sling.api.request.RequestParameterMap parameters)
protected PackageServlet.PackageOperationSet
getOperations()
Each servlet implementation must provide access to its operation set for request delegation.protected String
getStringParameter(org.apache.sling.api.request.RequestParameterMap parameters, String parameterName)
void
init()
setup of the servlet operation set for this servlet instanceprotected static void
jsonAnswer(com.google.gson.stream.JsonWriter writer, String operation, String status, String namespace, org.apache.jackrabbit.vault.packaging.PackageId packageId)
protected static void
jsonAnswer(com.google.gson.stream.JsonWriter writer, String operation, String status, org.apache.jackrabbit.vault.packaging.JcrPackageManager pckgMgr, org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage)
-
Methods inherited from class com.composum.sling.core.servlet.AbstractServiceServlet
deactivate, doDelete, doGet, doPost, doPut, getJsonObject, getJsonObject, getJsonObject, getPath, getResource, getRestrictions, getServiceKey, isEnabled, jsonAnswerItemExists, jsonValue, methodDeletePermission, methodGetPermission, methodPostPermission, methodPutPermission, setNoCacheHeaders, tryToUseRawSuffix
-
Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
getAllowedRequestMethods, isMethodValid, mayService
-
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
-
-
-
-
Field Detail
-
SERVICE_KEY
public static final String SERVICE_KEY
- See Also:
- Constant Field Values
-
SERVLET_PATH
public static final String SERVLET_PATH
- See Also:
- Constant Field Values
-
PARAM_GROUP
public static final String PARAM_GROUP
- See Also:
- Constant Field Values
-
PARAM_FORCE
public static final String PARAM_FORCE
- See Also:
- Constant Field Values
-
PARAM_REGISTRY
public static final String PARAM_REGISTRY
The key (namespace) of the PackageRegistry,PackageRegistries.Registries.getNamespaces()
.- See Also:
- Constant Field Values
-
PARAM_MERGED
public static final String PARAM_MERGED
Has value "merged" in some cases if it's important whether we are in registry merged mode or not.- See Also:
- Constant Field Values
-
ZIP_CONTENT_TYPE
public static final String ZIP_CONTENT_TYPE
- See Also:
- Constant Field Values
-
AUTO_SAVE
public static final boolean AUTO_SAVE
- See Also:
- Constant Field Values
-
operations
protected PackageServlet.PackageOperationSet operations
-
-
Method Detail
-
getOperations
protected PackageServlet.PackageOperationSet getOperations()
Description copied from class:AbstractServiceServlet
Each servlet implementation must provide access to its operation set for request delegation.- Specified by:
getOperations
in classAbstractServiceServlet
-
activate
protected void activate(org.osgi.framework.BundleContext bundleContext, PackageServlet.Configuration configuration)
-
init
public void init() throws javax.servlet.ServletException
setup of the servlet operation set for this servlet instance- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
getGroup
protected String getGroup(org.apache.sling.api.request.RequestParameterMap parameters) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
getName
protected String getName(org.apache.sling.api.request.RequestParameterMap parameters) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
getStringParameter
protected String getStringParameter(org.apache.sling.api.request.RequestParameterMap parameters, String parameterName) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
getArrayParameter
@Nonnull protected List<String> getArrayParameter(org.apache.sling.api.request.RequestParameterMap parameters, String parameterName) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
jsonAnswer
protected static void jsonAnswer(com.google.gson.stream.JsonWriter writer, String operation, String status, org.apache.jackrabbit.vault.packaging.JcrPackageManager pckgMgr, org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) throws IOException, javax.jcr.RepositoryException
- Throws:
IOException
javax.jcr.RepositoryException
-
jsonAnswer
protected static void jsonAnswer(com.google.gson.stream.JsonWriter writer, String operation, String status, String namespace, org.apache.jackrabbit.vault.packaging.PackageId packageId) throws IOException, javax.jcr.RepositoryException
- Throws:
IOException
javax.jcr.RepositoryException
-
fromJson
protected static void fromJson(com.google.gson.stream.JsonReader reader, org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) throws javax.jcr.RepositoryException, IOException
- Throws:
javax.jcr.RepositoryException
IOException
-
fromJson
protected static void fromJson(com.google.gson.stream.JsonReader reader, org.apache.jackrabbit.vault.packaging.JcrPackageDefinition definition) throws IOException
- Throws:
IOException
-
-