service.database.command.DatabaseInitiated Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of database-service Show documentation
Show all versions of database-service Show documentation
This is a library providing an API for accessing databases via socket connections
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";
}
}