| | |
| | | * @author Ulrich Hilger |
| | | * @version 1, 5.4.2021 |
| | | */ |
| | | public class StorageHandler implements HttpHandler { |
| | | public class StorageHandler extends AbstractHandler implements HttpHandler { |
| | | |
| | | private static final Logger logger = Logger.getLogger(StorageHandler.class.getName()); |
| | | |
| | |
| | | String elemName = elems[elems.length - 1]; |
| | | return fs.readJson(type, elemName); |
| | | } |
| | | } |
| | | |
| | | private String jsonWithEnclosingType(Object o) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("{\""); |
| | | sb.append(o.getClass().getSimpleName()); |
| | | sb.append("\": "); |
| | | Gson gson = new Gson(); |
| | | sb.append(gson.toJson(o)); |
| | | sb.append("}"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String bodyLesen(HttpExchange e) throws IOException { |