use of com.djrapitops.plan.delivery.web.resolver.exception.NotFoundException in project Plan by plan-player-analytics.
the class PlayerPageExporter method exportHtml.
private void exportHtml(ExportPaths exportPaths, Path playerDirectory, UUID playerUUID) throws IOException {
Path to = playerDirectory.resolve("index.html");
try {
Page page = pageFactory.playerPage(playerUUID);
export(to, exportPaths.resolveExportPaths(page.toHtml()));
} catch (IllegalStateException notFound) {
throw new NotFoundException(notFound.getMessage());
}
}
use of com.djrapitops.plan.delivery.web.resolver.exception.NotFoundException in project Plan by plan-player-analytics.
the class HttpsServerTest method testAccess.
default void testAccess(String address, String cookie) throws IOException, KeyManagementException, NoSuchAlgorithmException {
HttpURLConnection connection = null;
try {
connection = connector.getConnection("GET", address);
connection.setRequestProperty("Cookie", cookie);
int responseCode = connection.getResponseCode();
switch(responseCode) {
case 200:
case 302:
return;
case 400:
throw new BadRequestException("Bad Request: " + address);
case 403:
throw new ForbiddenException(address + " returned 403");
case 404:
throw new NotFoundException(address + " returned a 404, ensure that your server is connected to an up to date Plan server.");
case 500:
// Not supported
throw new IllegalStateException();
default:
throw new WebException(address + "| Wrong response code " + responseCode);
}
} finally {
connection.disconnect();
}
}
Aggregations