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

service.database.command.DatabaseInitiated Maven / Gradle / Ivy

package service.database.command;

import service.database.exception.DatabaseNotInitiatedException;
import service.database.exception.DatabaseRoleNotActivatedException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class DatabaseInitiated extends AbstractDatabaseCommand {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        setAccessControlAllowOriginHeader(req, resp);

        PrintWriter writer = new PrintWriter(resp.getOutputStream());
        try {
            checkDatabaseInitiated();
            writer.print(true);
            writer.flush();
        } catch (DatabaseNotInitiatedException ignored) {
            writer.print(false);
            writer.flush();
        } catch (DatabaseRoleNotActivatedException exception) {
            displayError(resp, 501, exception.getMessage());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy