You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by lixin chu <li...@yahoo.com> on 2004/11/04 03:29:44 UTC
how to get the folder structure ?
Hi,
is there an API to get a fodler structure ? I am
trying the propfindMethod(depth). It does return all
but not in a nested format so I have to rebuid the
tree structure.
btw, propfindMethod (path, depth) return error code
501 (not implemented). not sure why. what 'path'
should be used ? I tried "files", "/files" after
connecting to my local /slide/.
thanks
li xin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: how to get the folder structure ?
Posted by lixin chu <li...@yahoo.com>.
Is this the right way to get/build folder structure
for View layer in a typical web application ?
I tried, it took 2659ms with the default slide 2.1B2
configuration.
class BuildFolderStructure {
...
public BuildFolderStructure () {
// get tht root node
FolderNode = new FolderNode("slide",0);
WebdavResource webdavResource = new
WebdavResource(uriToHttpURL
("http://localhost:8080/slide/"));
names = webdavResource.listBasic();
addFoldersAsNodes(names , FolderNode, 1, 8,
webdavResource);
}
private addFoldersAsNodes (Vector col, FolderNode t,
int depthCount, int depthLimit, WebDavResource) {
/* loop through child directories */
Vector names;
for (int i = 0; i < col.size(); i++) {
// the Vector has n String arrays,
// each has 4 elements:
// 0: name
// 1: size
// 2: COLLECTION or not
// 3: date
String[] ele = (String[])col.elementAt(i);
if (ele[2].equalsIgnoreCase("collection")) {
/* create new node to add */
FolderNode newNode = new FolderNode(ele[0],
depthCount);
t.addChild(newNode);
/* check our depth, then recurse to add child
folders */
if (depthCount < depthLimit) {
String path= webdavResource.getPath();
try {
webdavResource.setPath(path+ele[0]+"/");
names = webdavResource.listBasic();
if (names.size() > 0) { depthCount++;
addFoldersAsNodes(names, newNode, depthCount,
depthLimit, webdavResource); depthCount--;
} webdavResource.setPath(path);
} catch (Exception e) {
}
}
}
}
}
}
--- lixin chu <li...@yahoo.com> wrote:
> Hi,
> is there an API to get a fodler structure ? I am
> trying the propfindMethod(depth). It does return all
> but not in a nested format so I have to rebuid the
> tree structure.
>
> btw, propfindMethod (path, depth) return error code
> 501 (not implemented). not sure why. what 'path'
> should be used ? I tried "files", "/files" after
> connecting to my local /slide/.
>
> thanks
> li xin
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> slide-user-help@jakarta.apache.org
>
>
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org