Removed autoupdate, addded deploy and build notifications #7

Merged
NorbiPeti merged 9 commits from dev into master 2017-07-04 16:41:29 +00:00
3 changed files with 39 additions and 1 deletions
Showing only changes of commit 897372f098 - Show all commits

View file

@ -111,6 +111,9 @@ public class ButtonWebsiteModule extends JavaPlugin {
@Override
public void onEnable() {
addPage(new IndexPage());
addPage(new AutoUpdatePage());
addPage(new LoginPage());
addPage(new ProfilePage());
TBMCCoreAPI.RegisterUserClass(WebUser.class);
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
this.getLogger().info("Starting webserver...");

View file

@ -0,0 +1,35 @@
package buttondevteam.website.page;
import java.io.IOException;
import java.util.stream.Collectors;
import com.sun.net.httpserver.HttpExchange;
import buttondevteam.website.io.IOHelper;
import buttondevteam.website.io.Response;
public class AutoUpdatePage extends Page {
@Override
public String GetName() {
return "autoupdate";
}
@Override
public Response handlePage(HttpExchange exchange) {
if (exchange.getRequestHeaders().containsKey("Expect")
&& exchange.getRequestHeaders().get("Expect").contains("100-continue"))
try {
exchange.sendResponseHeaders(100, -1);
exchange.getResponseBody().close();
} catch (IOException e1) {
e1.printStackTrace();
}
return new Response(200,
"Headers:\n" + exchange.getRequestHeaders().entrySet().stream()
.map(e -> e.getKey() + ": " + e.getValue().stream().collect(Collectors.joining(" ")))
.collect(Collectors.joining("\n")) + "\nPOST: " + IOHelper.GetPOST(exchange),
exchange);
}
}

View file

@ -22,7 +22,7 @@ public abstract class Page implements HttpHandler {
if (exchange.getRequestURI().getPath().equals("/" + GetName()))
IOHelper.SendResponse(handlePage(exchange));
else {
IOHelper.SendResponse(404, "404 Not found", exchange);
IOHelper.SendResponse(404, "404 Not found: " + exchange.getRequestURI().getPath(), exchange);
}
} catch (Exception e) {
TBMCCoreAPI.SendException("Internal Server Error in ButtonWebsiteModule!", e);