diff --git a/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java b/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java index 8bf7ad5958..be533084e7 100644 --- a/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java +++ b/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java @@ -1,16 +1,10 @@ package edu.unc.lib.boxc.web.services.processing; -import static edu.unc.lib.boxc.model.fcrepo.ids.RepositoryPaths.idToPath; - -import java.io.OutputStream; -import java.net.URI; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; - -import javax.servlet.http.HttpServletResponse; - -import com.fasterxml.jackson.databind.ObjectReader; -import info.freelibrary.iiif.presentation.v3.services.ImageService3; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import edu.unc.lib.boxc.common.util.URIUtil; +import edu.unc.lib.boxc.web.common.exceptions.ClientAbortException; +import edu.unc.lib.boxc.web.common.utils.FileIOUtil; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; @@ -24,13 +18,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.databind.ObjectMapper; - -import edu.unc.lib.boxc.common.util.URIUtil; -import edu.unc.lib.boxc.web.common.exceptions.ClientAbortException; -import edu.unc.lib.boxc.web.common.utils.FileIOUtil; - +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import static edu.unc.lib.boxc.model.fcrepo.ids.RepositoryPaths.idToPath; /** * Generates request, connects to, and streams the output from the image Server Proxy. Sets pertinent headers. @@ -72,14 +65,12 @@ public void getMetadata(String id, OutputStream outStream, response.setHeader("Content-Type", "application/json"); response.setHeader("content-disposition", "inline"); - ObjectReader iiifReader = new ObjectMapper().readerFor(ImageService3.class); - ImageService3 respData = iiifReader.readValue(httpResp.getEntity().getContent()); - var iiifWriter = new ObjectMapper().writerFor(ImageService3.class); - - respData.setID(new URI(URIUtil.join(baseIiifv3Path, id))); + var mapper = new ObjectMapper(); + var respData = mapper.readTree(httpResp.getEntity().getContent()); + ((ObjectNode) respData).put("id", URIUtil.join(baseIiifv3Path, id)); HttpEntity updatedRespData = EntityBuilder.create() - .setText(iiifWriter.writeValueAsString(respData)) + .setText(mapper.writeValueAsString(respData)) .setContentType(ContentType.APPLICATION_JSON).build(); httpResp.setEntity(updatedRespData);