code: public void addResponseHeaders(final HttpServletResponse servletResponse) {
  
          final String receivedParam = ofNullable(params.get("received")).orElse("");
          final List<String> includes = asList(ofNullable(params.get("include")).orElse(" ").split(" "));
          final List<String> omits = asList(ofNullable(params.get("omit")).orElse(" ").split(" "));
  
          final StringBuilder includeBuilder = new StringBuilder();
          final StringBuilder omitBuilder = new StringBuilder();
  
          if (!(value.equals("minimal") || receivedParam.equals("minimal"))) {
              final List<String> appliedPrefs = asList(PREFER_SERVER_MANAGED.toString(),
                      LDP_NAMESPACE + "PreferMinimalContainer",
                      LDP_NAMESPACE + "PreferMembership",
                      LDP_NAMESPACE + "PreferContainment");
              final List<String> includePrefs = asList(EMBED_CONTAINED.toString(),
                      INBOUND_REFERENCES.toString());
              includes.forEach(param -> includeBuilder.append(
                      (appliedPrefs.contains(param) || includePrefs.contains(param)) ? param + " " : ""));
  
              // Note: include params prioritized over omits during implementation
              omits.forEach(param -> omitBuilder.append(
                      (appliedPrefs.contains(param) && !includes.contains(param)) ? param + " " : ""));
          }
  
          // build the header for Preference Applied
          final String appliedReturn = value.equals("minimal") ? "return=minimal" : "return=representation";
          final String appliedReceived = receivedParam.equals("minimal") ? "received=minimal" : "";
  
          final StringBuilder preferenceAppliedBuilder = new StringBuilder(appliedReturn);
          preferenceAppliedBuilder.append(appliedReceived.length() > 0 ? "; " + appliedReceived : "");
          appendHeaderParam(preferenceAppliedBuilder, "include", includeBuilder.toString().trim());
          appendHeaderParam(preferenceAppliedBuilder, "omit", omitBuilder.toString().trim());
  
          servletResponse.addHeader("Preference-Applied", preferenceAppliedBuilder.toString().trim());
  
          servletResponse.addHeader("Vary", "Prefer");
      }
docs: Add appropriate response headers to indicate that the incoming preferences were acknowledged
  @param servletResponse the servlet response