public class SlingClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
HTTP_PREFIX |
static String |
LOCATION_HEADER |
| Constructor and Description |
|---|
SlingClient(String slingServerUrl,
String username,
String password) |
| Modifier and Type | Method and Description |
|---|---|
String |
createNode(String path,
Map<String,Object> properties)
Create a node at specified path, with optional properties
|
String |
createNode(String path,
String... properties)
Create a node at specified path, with optional properties
specified as a list of String arguments, odd values are keys
and even arguments are values.
|
void |
delete(String path)
Delete supplied path
|
boolean |
exists(String path) |
protected String |
getParentPath(String path)
Return parent path: whatever comes before the last / in path, empty
string if no / in path.
|
void |
mkdir(String path)
Create path using MKCOL
|
void |
mkdirs(String path)
Create path and all its parent folders, using MKCOL
|
void |
setProperties(String path,
Map<String,Object> properties)
Updates a node at specified path, with optional properties
|
void |
setProperties(String path,
String... properties)
Updates a node at specified path, with optional properties
specified as a list of String arguments, odd values are keys
and even arguments are values.
|
void |
upload(String path,
InputStream data,
int length,
boolean createFolders)
Upload using a PUT request.
|
public static final String LOCATION_HEADER
public static final String HTTP_PREFIX
public String createNode(String path, String... properties) throws IOException
IOExceptionpublic String createNode(String path, Map<String,Object> properties) throws UnsupportedEncodingException, IOException
path - Used in POST request to Sling serverproperties - If not null, properties are added to the created nodeUnsupportedEncodingExceptionIOExceptionpublic void setProperties(String path, String... properties) throws IOException
IOExceptionpublic void setProperties(String path, Map<String,Object> properties) throws IOException
IOExceptionpublic void delete(String path) throws IOException
IOExceptionpublic void upload(String path, InputStream data, int length, boolean createFolders) throws IOException
path - the path of the uploaded filedata - the contentlength - Use -1 if unknowncreateFolders - if true, intermediate folders are created via mkdirsIOExceptionpublic void mkdirs(String path) throws IOException
IOExceptionpublic void mkdir(String path) throws IOException
IOExceptionpublic boolean exists(String path) throws IOException
IOExceptionCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.