From: SVN c. m. f. t. SWORD-A. p. <swo...@li...> - 2011-04-25 13:14:20
|
Revision: 268 http://sword-app.svn.sourceforge.net/sword-app/?rev=268&view=rev Author: richard-jones Date: 2011-04-25 13:14:14 +0000 (Mon, 25 Apr 2011) Log Message: ----------- Add deposit options to ContainerAPI to support completion of In-Progress deposits, as per Section 9: Continued-Deposit Modified Paths: -------------- JavaServer2.0/src/main/java/org/swordapp/server/ContainerAPI.java JavaServer2.0/src/main/java/org/swordapp/server/ContainerManager.java Modified: JavaServer2.0/src/main/java/org/swordapp/server/ContainerAPI.java =================================================================== --- JavaServer2.0/src/main/java/org/swordapp/server/ContainerAPI.java 2011-04-24 19:45:05 UTC (rev 267) +++ JavaServer2.0/src/main/java/org/swordapp/server/ContainerAPI.java 2011-04-25 13:14:14 UTC (rev 268) @@ -168,8 +168,17 @@ String contentType = this.getContentType(req); boolean isMultipart = contentType.startsWith("multipart/related"); boolean isEntryOnly = contentType.startsWith("application/atom+xml"); - boolean isBinaryOnly = !isMultipart && !isEntryOnly; + // if neither of these content types are set, we may have a Binary-Only deposit or an empty deposit + // which is just providing instructions to the server (i.e. In-Progress is complete) + + // Content-Length is zero in this case + int contentLength = req.getContentLength(); + boolean headersOnly = contentLength == 0; + + // binary only is when none of the other types of request are fulfilled. + boolean isBinaryOnly = !isMultipart && !isEntryOnly && !headersOnly; + // get the common HTTP headers before leaping into the deposit type specific processes boolean inProgress = this.getInProgress(req); String iri = req.getRequestURI(); @@ -195,6 +204,11 @@ this.addDepositPropertiesFromBinary(deposit, req); receipt = this.cm.addResources(iri, deposit, auth); } + else if (headersOnly) + { + this.addDepositPropertiesFromBinary(deposit, req); + receipt = this.cm.useHeaders(iri, deposit, auth); + } else { // some other sort of deposit which is not supported (shouldn't ever get here) Modified: JavaServer2.0/src/main/java/org/swordapp/server/ContainerManager.java =================================================================== --- JavaServer2.0/src/main/java/org/swordapp/server/ContainerManager.java 2011-04-24 19:45:05 UTC (rev 267) +++ JavaServer2.0/src/main/java/org/swordapp/server/ContainerManager.java 2011-04-25 13:14:14 UTC (rev 268) @@ -22,5 +22,9 @@ DepositReceipt addResources(String editIRI, Deposit deposit, AuthCredentials auth) throws SwordError, SwordServerException; - void deleteContainer(String editIRI, AuthCredentials auth) throws SwordError, SwordServerException; + void deleteContainer(String editIRI, AuthCredentials auth) + throws SwordError, SwordServerException; + + DepositReceipt useHeaders(String editIRI, Deposit deposit, AuthCredentials auth) + throws SwordError, SwordServerException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |