All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.svws_nrw.api.RestAppAdminClient Maven / Gradle / Ivy

Go to download

Diese Bibliothek enthält die Java-Server-Definition der OpenApi-Schnittstelle für die Schulverwaltungssoftware in NRW

There is a newer version: 1.0.3
Show newest version
package de.svws_nrw.api;

import java.util.Set;

import de.svws_nrw.api.client.APIAdminClient;
import jakarta.ws.rs.core.Application;


/**
 * Diese Klasse stellt die Ressourcen für den SVWS-Client zur Verfügung, wenn
 * dieser vom SVWS-Server bereitgestellt wird.
 */
public final class RestAppAdminClient extends Application {

	/** Die Pfad-Spezifikation für diese Applikation */
	private static final String[] pathSpec = { "/admin/*" };

	/// Enthält alle Klassen, die für die OpenAPI eingebunden werden
	private final Set> classes = Set.of(
			APIAdminClient.class,
			OpenAPICorsFilter.class);

	@Override
	public Set> getClasses() {
		return this.classes;
	}

	/**
	 * Gibt die Pfad-Spezifikation für die App zurück
	 *
	 * @return die Pfad-Spezifikation
	 */
	public static String[] getPathSpecification() {
		return pathSpec;
	}

	/**
	 * Prüft, ob der übergebene Pfad in der Pfad-Spezifikation enthalten ist oder nicht
	 *
	 * @param path   der zu prüfende Pfad
	 *
	 * @return true, falls er enthalten ist
	 */
	public static boolean checkIsInPathSpecification(final String path) {
		if (path == null)
			return false;
		for (final String pathSpec : pathSpec)
			if (path.equals(pathSpec) || (pathSpec.endsWith("/*") && (path.equals(pathSpec.substring(0, pathSpec.length() - 2))))
					|| (pathSpec.endsWith("*") && (path.startsWith(pathSpec.substring(0, pathSpec.length() - 1)))))
				return true;
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy