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.
/*
* Copyright 2016, OpenRemote Inc.
*
* See the CONTRIBUTORS.txt file in the distribution for a
* full listing of individual contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.openremote.manager.web;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
import io.swagger.v3.oas.integration.SwaggerConfiguration;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.security.*;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariable;
import io.swagger.v3.oas.models.servers.ServerVariables;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.CanonicalPathHandler;
import io.undertow.server.handlers.PathHandler;
import io.undertow.server.handlers.RedirectHandler;
import io.undertow.server.handlers.resource.ClassPathResourceManager;
import io.undertow.server.handlers.resource.PathResourceManager;
import io.undertow.server.handlers.resource.ResourceManager;
import io.undertow.servlet.Servlets;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.ServletInfo;
import io.undertow.util.HttpString;
import org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher;
import org.jboss.resteasy.spi.ResteasyDeployment;
import org.openremote.container.security.IdentityService;
import org.openremote.container.web.WebService;
import org.openremote.model.Container;
import jakarta.ws.rs.WebApplicationException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static io.undertow.util.RedirectBuilder.redirect;
import static jakarta.ws.rs.core.Response.Status.NOT_FOUND;
import static jakarta.ws.rs.core.UriBuilder.fromUri;
import static org.openremote.container.util.MapAccess.getString;
import static org.openremote.model.Constants.REALM_PARAM_NAME;
import static org.openremote.model.util.ValueUtil.configureObjectMapper;
public class ManagerWebService extends WebService {
private static abstract class ServerVariableMixin {
@JsonProperty("default")
List _default;
}
private static abstract class StringSchemaMixin {
@JsonProperty("enum")
protected List _enum;
}
public static final int PRIORITY = LOW_PRIORITY + 100;
public static final String OR_APP_DOCROOT = "OR_APP_DOCROOT";
public static final String OR_APP_DOCROOT_DEFAULT = "ui/app";
public static final String OR_CUSTOM_APP_DOCROOT = "OR_CUSTOM_APP_DOCROOT";
public static final String OR_CUSTOM_APP_DOCROOT_DEFAULT = "deployment/manager/app";
public static final String OR_ROOT_REDIRECT_PATH = "OR_ROOT_REDIRECT_PATH";
public static final String OR_ROOT_REDIRECT_PATH_DEFAULT = "/manager";
public static final String API_PATH = "/api";
public static final String MANAGER_APP_PATH = "/manager";
public static final String INSIGHTS_APP_PATH = "/insights";
public static final String SWAGGER_APP_PATH = "/swagger";
public static final String CONSOLE_LOADER_APP_PATH = "/console_loader";
public static final String SHARED_PATH = "/shared";
public static final List APP_PATHS = List.of(MANAGER_APP_PATH, INSIGHTS_APP_PATH, SWAGGER_APP_PATH, CONSOLE_LOADER_APP_PATH, SHARED_PATH);
public static final String UI_CLASSPATH_PREFIX = "org/openremote/web";
private static final Logger LOG = Logger.getLogger(ManagerWebService.class.getName());
protected static final Pattern PATTERN_REALM_SUB = Pattern.compile("/([a-zA-Z0-9\\-_]+)/(.*)");
protected boolean initialised;
protected Path builtInAppDocRoot;
protected Path customAppDocRoot;
protected Collection> apiClasses = new HashSet<>();
protected Collection