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

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

Go to download

This is a library providing an API for accessing databases via socket connections

There is a newer version: 4.0.5
Show newest version
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());
        }
    }

    public static String getCommand(){
        return "/command/database/initiated";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy