mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-05 10:20:23 +01:00
Moved unnecessary response.api package classes
This commit is contained in:
parent
cab63df82f
commit
bf1f28388d
@ -11,7 +11,7 @@ import com.djrapitops.plan.system.locale.lang.ErrorPageLang;
|
||||
import com.djrapitops.plan.system.webserver.Request;
|
||||
import com.djrapitops.plan.system.webserver.pages.PageHandler;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.BadRequestResponse;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
@ -13,7 +13,7 @@ import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.BadRequestResponse;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.update.ShutdownUpdateHook;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.BadRequestResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -11,7 +11,6 @@ import com.djrapitops.plan.system.locale.lang.ErrorPageLang;
|
||||
import com.djrapitops.plan.system.webserver.auth.Authentication;
|
||||
import com.djrapitops.plan.system.webserver.pages.*;
|
||||
import com.djrapitops.plan.system.webserver.response.*;
|
||||
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.*;
|
||||
|
@ -4,8 +4,6 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.response;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.response.api.SuccessResponse;
|
||||
|
||||
/**
|
||||
* Enum containing default responses that don't need to be cached because they're always the same.
|
||||
*
|
||||
@ -13,7 +11,7 @@ import com.djrapitops.plan.system.webserver.response.api.SuccessResponse;
|
||||
*/
|
||||
public enum DefaultResponses {
|
||||
BASIC_AUTH(PromptAuthorizationResponse.getBasicAuthResponse()),
|
||||
SUCCESS(new SuccessResponse());
|
||||
SUCCESS(new TextResponse("Success"));
|
||||
|
||||
private final Response response;
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.djrapitops.plan.system.webserver.response;
|
||||
|
||||
/**
|
||||
* Response for raw text.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class TextResponse extends Response {
|
||||
|
||||
public TextResponse(String content) {
|
||||
setHeader("HTTP/1.1 200 OK");
|
||||
setContent(content);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* License is provided in the jar as LICENSE also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.response.api;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.ResponseType;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* @author Fuzzlemann
|
||||
*/
|
||||
public class JsonResponse extends Response {
|
||||
|
||||
public <T> JsonResponse(T object) {
|
||||
super(ResponseType.JSON);
|
||||
Gson gson = new Gson();
|
||||
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
super.setContent(gson.toJson(object));
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* License is provided in the jar as LICENSE also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.response.api;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
|
||||
/**
|
||||
* @author Fuzzlemann
|
||||
*/
|
||||
public class SuccessResponse extends Response {
|
||||
|
||||
public SuccessResponse() {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
super.setContent("Success");
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* License is provided in the jar as LICENSE also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.response.api;
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
|
@ -14,6 +14,7 @@ import com.djrapitops.plan.utilities.html.pages.NetworkPage;
|
||||
public class NetworkPageResponse extends Response {
|
||||
|
||||
public NetworkPageResponse() throws ParseException {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
NetworkContainer networkContainer = CacheSystem.getInstance().getDataContainerCache().getNetworkContainer();
|
||||
setContent(new NetworkPage(networkContainer).toHtml());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user