code: @SuppressWarnings("resource")
      protected Response createUpdateResponse(final FedoraResource resource, final boolean created) {
          addCacheControlHeaders(servletResponse, resource, session);
          addResourceLinkHeaders(resource, created);
          addExternalContentHeaders(resource);
          addAclHeader(resource);
          addMementoHeaders(resource);
  
          if (!created) {
              return noContent().build();
          }
  
          final URI location = getUri(resource);
          final Response.ResponseBuilder builder = created(location);
  
          if (prefer == null || !prefer.hasReturn()) {
              final MediaType acceptablePlainText = acceptabePlainTextMediaType();
              if (acceptablePlainText != null) {
                  return builder.type(acceptablePlainText).entity(location.toString()).build();
              }
              return notAcceptable(mediaTypes(TEXT_PLAIN_TYPE).build()).build();
          } else if (prefer.getReturn().getValue().equals("minimal")) {
              return builder.build();
          } else {
              if (prefer != null) {
                  prefer.getReturn().addResponseHeaders(servletResponse);
              }
              final RdfNamespacedStream rdfStream = new RdfNamespacedStream(
                  new DefaultRdfStream(asNode(resource), getResourceTriples(resource)),
                  namespaceRegistry.getNamespaces());
              return builder.entity(rdfStream).build();
          }
      }
docs: Create the appropriate response after a create or update request is processed. When a resource is created,
  examine the Prefer and Accept headers to determine whether to include a representation. By default, the URI for
  the created resource is return as plain text. If a minimal response is requested, then no body is returned. If a
  non-minimal return is requested, return the RDF for the created resource in the appropriate RDF serialization.
  
  @param resource The created or updated Fedora resource.
  @param created True for a newly-created resource, false for an updated resource.
  @return 204 No Content (for updated resources), 201 Created (for created resources) including the resource URI or
  content depending on Prefer headers.