idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
- From: "AFS account Florian Huebner" <huebner AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r365 - trunk/java/ch/idok/service/server/io/rest
- Date: Thu, 14 May 2009 10:55:28 +0200
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: huebner
Date: Thu May 14 10:55:28 2009
New Revision: 365
Log:
Implemented repository browsing via REST
Modified:
trunk/java/ch/idok/service/server/io/rest/RestIOServiceResource.java
Modified: trunk/java/ch/idok/service/server/io/rest/RestIOServiceResource.java
==============================================================================
--- trunk/java/ch/idok/service/server/io/rest/RestIOServiceResource.java
(original)
+++ trunk/java/ch/idok/service/server/io/rest/RestIOServiceResource.java
Thu May 14 10:55:28 2009
@@ -99,9 +99,9 @@
public Response queryFolderContent(@PathParam("path") String path) {
logger.entering(this.getClass().getName(),
"queryFolderContent");
// Parse project, repository and folder
- String project;
- String repository = null;
- String folder = null;
+ String project = "";
+ String repository = "";
+ String folder = "";
String[] sa = path.split("/", 3);
project = sa[0];
@@ -114,7 +114,7 @@
try {
// todo: create URI from path - is there a more
direct way in
// defining the path to the document ?
- URI uri =
URIUtil.parseUserURI(baseURI+project+"/"+repository);
+ URI uri =
URIUtil.parseUserURI("https://dms02.psi.ch/"+project+"/"+repository);
RepositoryId repoId = mgr.getRepositoryId(uri,
RepositoryManager.LocationType.ROOT);
Repository repo = mgr.getRepository(repoId);
@@ -122,15 +122,24 @@
Iterable<RepositoryDirEntry> entries =
repo.getDir(repo
.getRepositoryPath(docId));
StringBuilder sb = new StringBuilder();
+ sb.append("<?xml version=\"1.0\"?> <!DOCTYPE html
PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"> <html
xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">");
sb.append("<html><head><title>Revision" +
repo.getLatestVersion() + ": /</title></head>");
+ sb.append("<body>");
+ sb.append(" <h2>Revision " + repo.getLatestVersion()
+ ": /</h2>");
+ sb.append(" <ul>");
for (RepositoryDirEntry entry : entries) {
if (entry.getType() == PathType.DIRECTORY) {
// fillFolderRow(parent,
entry.getId().getTail());
// sb.append...
+ sb.append(String.format(" <li><a
href=\"%s\">%s/</a></li>",entry.getId(),entry.getId()));
} else if (entry.getType() == PathType.FILE) {
// fillDocumentRow(entry);
+ sb.append(String.format(" <li><a
href=\"%s\">%s</a></li>",uri.toString()+"/"+entry.getId(),entry.getId()));
}
}
+ sb.append("</ul>");
+ sb.append("<hr noshade>");
+ sb.append("</body></html>");
return Response.ok().entity(sb).build();
} catch (Exception e) {
// TODO: handle exception
- [idok-commit] idok commit r365 - trunk/java/ch/idok/service/server/io/rest, AFS account Florian Huebner, 05/14/2009
Archive powered by MHonArc 2.6.19.