Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
removed the call to getAuthenticatedSession
  • Loading branch information
fasseg committed Jun 18, 2013
1 parent 17b78a5 commit 4f40414
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Expand Up @@ -68,29 +68,27 @@ public Response ingestAndMint(@PathParam("path")

logger.debug("Attempting to ingest with path: {}", path);

final Session session = getAuthenticatedSession();

try {
if (nodeService.exists(session, path)) {
if (nodeService.exists(this.session, path)) {
return Response.status(SC_CONFLICT).entity(
path + " is an existing resource").build();
}

final FedoraResource resource =
createObjectOrDatastreamFromRequestContent(
FedoraNodes.class, session, path, mixin, uriInfo,
FedoraNodes.class, this.session, path, mixin, uriInfo,
requestBodyStream, requestContentType,
checksumType, checksum);

session.save();
this.session.save();
logger.debug("Finished creating {} with path: {}", mixin, path);
return created(
uriInfo.getBaseUriBuilder().path(FedoraNodes.class).build(
resource.getPath().substring(1))).entity(path)
.build();

} finally {
session.logout();
this.session.logout();
}
}

Expand Down
15 changes: 6 additions & 9 deletions fcrepo-http-api/src/main/java/org/fcrepo/api/FedoraVersions.java
Expand Up @@ -65,10 +65,9 @@ public Response getVersionList(@PathParam("path")
final Variant bestPossibleResponse =
request.selectVariant(POSSIBLE_RDF_VARIANTS);

final Session session = getAuthenticatedSession();
try {
final FedoraResource resource =
nodeService.getObject(session, path);
nodeService.getObject(this.session, path);

return Response.ok(
new GraphStoreStreamingOutput(resource
Expand All @@ -77,7 +76,7 @@ public Response getVersionList(@PathParam("path")
bestPossibleResponse.getMediaType())).build();

} finally {
session.logout();
this.session.logout();
}

}
Expand All @@ -89,15 +88,14 @@ public Response addVersionLabel(@PathParam("path")
final String versionLabel) throws RepositoryException {

final String path = toPath(pathList);
final Session session = getAuthenticatedSession();
try {
final FedoraResource resource =
nodeService.getObject(session, path);
nodeService.getObject(this.session, path);
resource.addVersionLabel(versionLabel);

return Response.noContent().build();
} finally {
session.logout();
this.session.logout();
}
}

Expand All @@ -112,10 +110,9 @@ public Dataset getVersion(@PathParam("path")
LOGGER.trace("getting version profile for {} at version {}", path,
versionLabel);

final Session session = getAuthenticatedSession();
try {
final FedoraResource resource =
nodeService.getObject(session, path, versionLabel);
nodeService.getObject(this.session, path, versionLabel);

if (resource == null) {
throw new WebApplicationException(status(NOT_FOUND).build());
Expand All @@ -126,7 +123,7 @@ public Dataset getVersion(@PathParam("path")
}

} finally {
session.logout();
this.session.logout();
}

}
Expand Down

0 comments on commit 4f40414

Please sign in to comment.