Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sling.servlets.post;
import org.apache.sling.servlets.post.impl.contentparser.impl.JsonTicksConverter;
import jakarta.json.Json;
import jakarta.json.JsonArrayBuilder;
import jakarta.json.JsonObject;
import jakarta.json.JsonObjectBuilder;
import jakarta.json.JsonStructure;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.StringReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The JSONResponse is an {@link AbstractPostResponse} preparing
* the response in JSON.
*/
public class JSONResponse extends AbstractPostResponse {
public static final String RESPONSE_CONTENT_TYPE = "application/json";
// package private because it is used by the unit test
static final String PROP_TYPE = "type";
// package private because it is used by the unit test
static final String PROP_ARGUMENT = "argument";
// package private because it is used by the unit test
static final String RESPONSE_CHARSET = "UTF-8";
private static final String PROP_CHANGES = "changes";
private Map json = new HashMap<>();
private Map jsonCached = new HashMap<>();
private List