Class DownloadJcrTreeAsPackageServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- com.composum.nodes.debugutil.DownloadJcrTreeAsPackageServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class DownloadJcrTreeAsPackageServlet extends org.apache.sling.api.servlets.SlingSafeMethodsServlet
This is a servlet that enables to download a package of a JCR subtree without having to create a package in the package manager. The package is created on the fly, and not saved to disk / the repository, so this is better suited to large content trees, but valuable also for quickly downloading a page.CAUTION: not suitable for production, only for internal testing systems!
Usage with curl e.g. curl -s -S -o tmp.zip -u admin:admin http://localhost:6502/somepath.html/{path to download}
where somepath is a path to a resource with sling:resourceType cpm/nodes/debug/downloadjcr .Example Creates a package of /some/path: http://localhost:6502/somepath.html/some/path
Fragment of a bash script to download a path from another AEM system and install it locally on AEM: path=$1 TMPFIL=`mktemp -u`.zip trap "{ rm -f $TMPFIL; }" EXIT PKG=$(basename $TMPFIL) curl -S -o $TMPFIL -u ${OTHER_USER}:${OTHER_PWD} http://${OTHERIP}:4502/somepath.html${path}?packageName=$PKG curl -u admin:admin -F file=@"$TMPFIL" -F name="tmp $path" -F force=true -F install=true http://localhost:6502/crx/packmgr/service.jsp curl -u admin:admin -F cmd=delete http://localhost:6502/crx/packmgr/service/.json/etc/packages/my_packages/${PKG%%.zip}-1.zip
- See Also:
- "https://gist.github.com/stoerr/a54c58b4b05770c6a7ee39654ea84305", Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DownloadJcrTreeAsPackageServlet.Configuration
-
Constructor Summary
Constructors Constructor Description DownloadJcrTreeAsPackageServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(DownloadJcrTreeAsPackageServlet.Configuration config)
protected void
deactivate()
protected void
doGet(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
-
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doHead, doOptions, doTrace, getAllowedRequestMethods, getServletInfo, handleMethodNotImplemented, mayService, service, service
-
-
-
-
Method Detail
-
doGet
protected void doGet(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException
- Overrides:
doGet
in classorg.apache.sling.api.servlets.SlingSafeMethodsServlet
- Throws:
javax.servlet.ServletException
IOException
-
activate
protected void activate(DownloadJcrTreeAsPackageServlet.Configuration config)
-
deactivate
protected void deactivate()
-
-