ProblemRFC7807.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.utils.rest.problem;

  21. import java.util.HashMap;
  22. import java.util.Map;

  23. /**
  24.  * ProblemRFC7807
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class ProblemRFC7807 {

  31.     private String type;
  32.     private String title;
  33.     private Integer status;
  34.     private String detail;
  35.     private String instance;
  36.    
  37.     private Map<String, Object> custom = new HashMap<>();

  38.     private String raw;
  39.    
  40.     public String getType() {
  41.         return this.type;
  42.     }
  43.     public void setType(String type) {
  44.         this.type = type;
  45.     }

  46.     public String getTitle() {
  47.         return this.title;
  48.     }
  49.     public void setTitle(String title) {
  50.         this.title = title;
  51.     }

  52.     public Integer getStatus() {
  53.         return this.status;
  54.     }
  55.     public void setStatus(Integer status) {
  56.         this.status = status;
  57.     }

  58.     public String getDetail() {
  59.         return this.detail;
  60.     }
  61.     public void setDetail(String detail) {
  62.         this.detail = detail;
  63.     }

  64.     public String getInstance() {
  65.         return this.instance;
  66.     }
  67.     public void setInstance(String instance) {
  68.         this.instance = instance;
  69.     }

  70.     public Map<String, Object> getCustom() {
  71.         return this.custom;
  72.     }
  73.     public void setCustom(Map<String, Object> custom) {
  74.         this.custom = custom;
  75.     }
  76.    
  77.     public String getRaw() {
  78.         return this.raw;
  79.     }
  80.     public void setRaw(String raw) {
  81.         this.raw = raw;
  82.     }
  83.    
  84.     @Override
  85.     public String toString() {
  86.         StringBuilder sb = new StringBuilder();
  87.         JsonSerializer serializer = new JsonSerializer(true);
  88.         try {
  89.             sb.append(serializer.toString(this));
  90.         }catch(Exception e) {
  91.             sb.append("Serialization error: "+e.getMessage());
  92.         }
  93.         return sb.toString();
  94.     }
  95. }