org.apache.sling.servlets.post.impl.helper
Class SlingFileUploadHandler
java.lang.Object
org.apache.sling.servlets.post.impl.helper.SlingFileUploadHandler
public class SlingFileUploadHandler
- extends Object
Handles file uploads.
Simple example:
this will create a nt:file node below "/home/admin" if the node type of
"admin" is (derived from) nt:folder, a nt:resource node otherwise.
Filename example:
same as above, but uses the filename of the uploaded file as name for the
new node.
Type hint example:
this will create a new node with the type my:file below admin. if the hinted
type extends from nt:file an intermediate file node is created otherwise
directly a resource node.
Constructor Summary |
SlingFileUploadHandler(javax.servlet.ServletContext servletCtx)
Constructs file upload handler |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NT_FOLDER
public static final String NT_FOLDER
- See Also:
- Constant Field Values
NT_FILE
public static final String NT_FILE
- See Also:
- Constant Field Values
NT_RESOURCE
public static final String NT_RESOURCE
- See Also:
- Constant Field Values
NT_UNSTRUCTURED
public static final String NT_UNSTRUCTURED
- See Also:
- Constant Field Values
JCR_CONTENT
public static final String JCR_CONTENT
- See Also:
- Constant Field Values
JCR_LASTMODIFIED
public static final String JCR_LASTMODIFIED
- See Also:
- Constant Field Values
JCR_MIMETYPE
public static final String JCR_MIMETYPE
- See Also:
- Constant Field Values
JCR_ENCODING
public static final String JCR_ENCODING
- See Also:
- Constant Field Values
JCR_DATA
public static final String JCR_DATA
- See Also:
- Constant Field Values
SlingFileUploadHandler
public SlingFileUploadHandler(javax.servlet.ServletContext servletCtx)
- Constructs file upload handler
- Parameters:
servletCtx
- the post processor
setFile
public void setFile(javax.jcr.Node parent,
RequestProperty prop,
List<Modification> changes)
throws javax.jcr.RepositoryException
- Uses the file(s) in the request parameter for creation of new nodes.
if the parent node is a nt:folder a new nt:file is created. otherwise
just a nt:resource. if the
name
is '*', the filename of
the uploaded file is used.
- Parameters:
parent
- the parent nodeprop
- the assembled property info
- Throws:
javax.jcr.RepositoryException
- if an error occurs
Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.