request.user());
isGetRequest = !request.isRootRequest();
isIndexRequest = !isGetRequest;
} else if (action.actionInsert()) {
DocumentNode insertNode = this.getInsertNode(request);
page = new RedirectPage(request, database().insertNode(
request.wri().resourceIdentifier(), insertNode,
request.user()));
} else if (action.actionUpdate()) {
if (request.parameters().hasParameter(ParameterDatabaseID)) {
// Updating a configuration file
this.updateConfigurationFile(request);
// Configuration files may be modified either while viewing
// the
// database index or and object. Make sure to display the
// appropriate
// page after the update.
isGetRequest = !request.isRootRequest();
isIndexRequest = !isGetRequest;
} else {
// Updating a data object
Update update = this.getNodeUpdates(request);
if (update != null) {
database().update(request.wri().resourceIdentifier(),
update, request.user());
if (request.node().isText()) {
page = new RedirectPage(request,
((DatabaseTextNode) request.node())
.parent().identifier());
}
}
isGetRequest = true;
}
}
} else if (request.type().isActivate()) {
database().activate(request.wri().resourceIdentifier(),
request.user());
} else if (request.type().isCopy()) {
String sourceURL = "http://localhost" + ":"
+ exchange.getLocalPort()
+ request.wri().getURL();
RequestParameterVersion version = RequestParameter
.versionParameter(request.parameters().get(
RequestParameter.ParameterVersion));
if (version.versionSingle()) {
sourceURL = sourceURL + "?" + version.toURLString();
} else {
sourceURL = sourceURL
+ "?"
+ new RequestParameterVersionSingle(this.database()
.versionIndex().getLastVersion().number())
.toURLString();
}
exchange.setResponseHeader("Set-Cookie", HttpRequest.CookiePropertyCopyBuffer + "=" + URLEncoder.encode(sourceURL, "UTF-8") + "; path=/; ");
} else if (request.type().isDelete()) {
database().delete(request.wri().resourceIdentifier(),
request.user());
if (request.node().parent() != null) {
page = new RedirectPage(request, request.node().parent()
.identifier());
} else {
isIndexRequest = true;
}
} else if (request.type().isPaste()) {