View Javadoc
1   package de.dlr.shepard.common.exceptions;
2   
3   import jakarta.ws.rs.core.Response.Status;
4   import lombok.Getter;
5   import org.eclipse.microprofile.openapi.annotations.media.Schema;
6   
7   /**
8    * A class to represent an Api response object for invalid/ unsafe Html.
9    */
10  @Getter
11  @Schema(name = "InvalidHtmlResponse")
12  public class InvalidHtmlResponse {
13  
14    @Schema(readOnly = true)
15    private final String message =
16      "You provided invalid or unsecure Html to the Api. " +
17      "Please make sure that your provided Html does not contain any invalid tags or attributes. " +
18      "See the 'sanitizedHtml' field to find out which tags and attributes were removed during sanitization.";
19  
20    @Schema(readOnly = true)
21    private final String exception = "BadRequestException";
22  
23    @Schema(readOnly = true)
24    private final Status status = Status.BAD_REQUEST;
25  
26    @Schema(readOnly = true)
27    private final String suppliedHtml;
28  
29    @Schema(readOnly = true)
30    private final String sanitizedHtml;
31  
32    public InvalidHtmlResponse(String suppliedHtml, String sanitizedHtml) {
33      this.suppliedHtml = suppliedHtml;
34      this.sanitizedHtml = sanitizedHtml;
35    }
36  }