From baf61457a209ac212d62dca74ea1bba93ab679ea Mon Sep 17 00:00:00 2001 From: Katsute Date: Sun, 10 May 2020 12:54:12 -0400 Subject: [PATCH 1/5] Add SimpleHttpsServer front --- .../simplehttpserver/SimpleHttpServer.java | 1 + .../simplehttpserver/SimpleHttpsServer.java | 104 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java index a4b3813..0233139 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java @@ -14,6 +14,7 @@ * * @see HttpServer * @see HttpHandler + * @see SimpleHttpsServer * @see SimpleHttpHandler * @since 02.00.00 * @version 03.04.00 diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java new file mode 100644 index 0000000..38e3c0b --- /dev/null +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java @@ -0,0 +1,104 @@ +package com.kttdevelopment.simplehttpserver; + +import com.sun.net.httpserver.*; + +import java.io.IOException; + +/** + * This class is a simplified implementation of {@link HttpsServer}.
+ * At least one {@link HttpHandler} must be created in order to process requests. When handling requests the server will use the most specific context. If no handler can be found it is rejected with a 404 response.
+ * Contexts are case-sensitive. + * + * @see HttpsServer + * @see HttpHandler + * @see SimpleHttpServer + * @see SimpleHttpHandler + * @since 02.00.00 + * @version 03.04.00 + * @author Ktt Development + */ +public abstract class SimpleHttpsServer extends SimpleHttpServer { + + /** + * Create an empty {@link SimpleHttpsServer}. Applications don't use this method. + * + * @see SimpleHttpsServerImpl#create(Integer, Integer) + * @since 02.00.00 + * @author Ktt Development + */ + SimpleHttpsServer(){ } + +// + + /** + * Creates a {@link SimpleHttpsServer}. + * + * @return a {@link SimpleHttpsServer} + * @throws IOException uncaught exception + * + * @since 03.04.00 + * @author Ktt Development + */ + public static SimpleHttpsServer create() throws IOException { + return SimpleHttpsServerImpl.create(null,null); + } + + /** + * Creates a {@link SimpleHttpsServer} bounded to a port. + * + * @param port port to bind to + * @return a {@link SimpleHttpsServer} + * @throws java.net.BindException if server can not bind to port + * @throws NullPointerException if address is null + * @throws IllegalArgumentException if port is out of range + * @throws IOException uncaught exception + * + * @since 03.04.00 + * @author Ktt Development + */ + public static SimpleHttpsServer create(final int port) throws IOException { + return SimpleHttpsServerImpl.create(port,null); + } + + /** + * Creates a {@link SimpleHttpsServer} bounded to a port. + * + * @param port port to bind to + * @param backlog request backlog + * @return a {@link SimpleHttpsServer} + * @throws java.net.BindException if server can not bind to port + * @throws NullPointerException if address is null + * @throws IllegalArgumentException if port is out of range + * @throws IOException uncaught exception + * + * @since 03.04.00 + * @author Ktt Development + */ + public static SimpleHttpsServer create(final int port, final int backlog) throws IOException { + return SimpleHttpsServerImpl.create(port,backlog); + } + +// + + /** + * Sets a https configurator for the server + * + * @param config the https configurator + * @throws NullPointerException if config is null + * + * @since 03.04.00 + * @author Ktt Development + */ + public abstract void setHttpsConfigurator(HttpsConfigurator config); + + /** + * Returns the https configurator of the server + * + * @return the https configurator + * + * @since 03.04.00 + * @author Ktt Development + */ + public abstract HttpsConfigurator getHttpsConfigurator(); + +} From c836eb5a98dfcb9abf1597089c33978b0bc40c0a Mon Sep 17 00:00:00 2001 From: Katsute Date: Sun, 10 May 2020 12:56:04 -0400 Subject: [PATCH 2/5] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bd45f9d..2bd940c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.kttdevelopment simplehttpserver - 03.03.00 + 03.04.00 jar https://github.com/Ktt-Development/simplehttpserver From 103c135c7370e2843bd1a59d7a7e7aa9c32fad09 Mon Sep 17 00:00:00 2001 From: Katsute Date: Sun, 10 May 2020 13:09:49 -0400 Subject: [PATCH 3/5] Implement SimpleHttpsServer --- .../simplehttpserver/SimpleHttpsServer.java | 15 + .../SimpleHttpsServerImpl.java | 285 ++++++++++++++++++ 2 files changed, 300 insertions(+) create mode 100644 src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java index 38e3c0b..433da79 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java @@ -78,6 +78,21 @@ public static SimpleHttpsServer create(final int port, final int backlog) throws return SimpleHttpsServerImpl.create(port,backlog); } +// + + /** + * Returns the native https server. + * + * @return https server + * + * @see HttpsServer + * @since 03.04.00 + * @author Ktt Development + */ + @Override + public abstract HttpsServer getHttpServer(); + + // /** diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java new file mode 100644 index 0000000..96b6ea2 --- /dev/null +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java @@ -0,0 +1,285 @@ +package com.kttdevelopment.simplehttpserver; + +import com.kttdevelopment.simplehttpserver.handler.RootHandler; +import com.sun.net.httpserver.*; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.*; +import java.util.concurrent.Executor; + +/** + * Implementation for {@link SimpleHttpsServer}. Applications do not use this class. + * + * @see SimpleHttpsServer + * @since 03.04.00 + * @version 03.04.00 + * @author Ktt Development + */ +final public class SimpleHttpsServerImpl extends SimpleHttpsServer { + + private final HttpsServer server = HttpsServer.create(); + + private HttpSessionHandler sessionHandler; + + private final Map contexts = new HashMap<>(); + + private boolean running = false; + + /** + * Creates a {@link SimpleHttpServer}. + * + * @param port port to run the server on + * @param backlog how many requests to backlog + * @return a {@link SimpleHttpServer} + * @throws java.net.BindException if server can not bind to port + * @throws IOException uncaught exception + * + * @see SimpleHttpServer + * @since 03.04.00 + * @author Ktt Development + */ + static SimpleHttpsServer create(final Integer port, final Integer backlog) throws IOException{ + return new SimpleHttpsServerImpl(port,backlog); + } + + SimpleHttpsServerImpl(final Integer port, final Integer backlog) throws IOException{ + if(port != null) + server.bind(new InetSocketAddress(port), backlog != null ? backlog : 0); + } + + private void handle(final HttpExchange exchange){ + if(sessionHandler != null) + sessionHandler.getSession(exchange).updateLastAccessTime(); + } + +// + + @Override + public final HttpsServer getHttpServer(){ + return server; + } + +// + + @Override + public final void setHttpsConfigurator(final HttpsConfigurator config){ + server.setHttpsConfigurator(config); + } + + @Override + public final HttpsConfigurator getHttpsConfigurator(){ + return server.getHttpsConfigurator(); + } + + // region copySimpleHttpServerImpl + + @Override + public synchronized final InetSocketAddress bind(final int port) throws IOException{ + final InetSocketAddress addr = new InetSocketAddress(port); + server.bind(addr, 0); + return addr; + } + + @Override + public synchronized final InetSocketAddress bind(final int port, final int backlog) throws IOException{ + final InetSocketAddress addr = new InetSocketAddress(port); + server.bind(addr, backlog); + return addr; + } + + @Override + public synchronized final void bind(final InetSocketAddress addr) throws IOException{ + server.bind(addr,0); + } + + @Override + public synchronized final void bind(final InetSocketAddress addr, final int backlog) throws IOException{ + server.bind(addr,backlog); + } + +// + + @Override + public final InetSocketAddress getAddress(){ + return server.getAddress(); + } + +// + + @Override + public synchronized final void setExecutor(final Executor executor){ + server.setExecutor(executor); + } + + @Override + public final Executor getExecutor(){ + return server.getExecutor(); + } + + @Override + public synchronized final void setHttpSessionHandler(final HttpSessionHandler sessionHandler){ + this.sessionHandler = sessionHandler; + } + + @Override + public final HttpSessionHandler getHttpSessionHandler(){ + return sessionHandler; + } + + @Override + public final HttpSession getHttpSession(final HttpExchange exchange){ + return sessionHandler != null ? sessionHandler.getSession(exchange) : null; + } + + @Override + public final HttpSession getHttpSession(final SimpleHttpExchange exchange){ + return getHttpSession(exchange.getHttpExchange()); + } + + // + + @Override + public synchronized final HttpContext createContext(final String path){ + return createContext(path,(HttpExchange exchange) -> {}); + } + + @Override + public synchronized final HttpContext createContext(final String path, final HttpHandler handler){ + if(!getContext(path).equals("/") && handler instanceof RootHandler) + throw new IllegalArgumentException("RootHandler can only be used at the root '/' context"); + + final HttpHandler wrapper = exchange -> { + handle(exchange); + handler.handle(exchange); + }; + final HttpContext context = server.createContext(getContext(path),wrapper); + + contexts.put(context,handler); + + return context; + } + + // + + @Override + public synchronized final HttpContext createContext(final String path, final Authenticator authenticator){ + final HttpContext context = createContext(path); + context.setAuthenticator(authenticator); + return context; + } + + @Override + public synchronized final HttpContext createContext(final String path, final HttpHandler handler, final Authenticator authenticator){ + final HttpContext context = createContext(path,handler); + context.setAuthenticator(authenticator); + return context; + } + + // + + @Override + public synchronized final void removeContext(final String path){ + server.removeContext(getContext(path)); + for(final HttpContext context : contexts.keySet()){ + if(context.getPath().equalsIgnoreCase(getContext(path))){ + contexts.remove(context); + break; + } + } + } + + @Override + public synchronized final void removeContext(final HttpContext context){ + contexts.remove(context); + server.removeContext(context); + } + +// + + @Override + public final HttpHandler getContextHandler(final String path){ + for(final HttpContext context : contexts.keySet()) + if(context.getPath().equals(getContext(path))) + return context.getHandler(); + return null; + } + + @Override + public final HttpHandler getContextHandler(final HttpContext context){ + return contexts.get(context); + } + + @Override + public final Map getContexts(){ + return new HashMap<>(contexts); + } + + // + + @Override + public synchronized final String getRandomContext(){ + return getRandomContext(""); + } + + @Override + public synchronized final String getRandomContext(final String context){ + String targetContext; + + final String head = context.isEmpty() ? "" : getContext(context); + + do targetContext = head + getContext(UUID.randomUUID().toString()); + while(getContextHandler(targetContext) != null); + + return targetContext; + } + + + // + + @Override + public synchronized final void start(){ + if(!running){ + server.start(); + running = true; + } + } + + @Override + public synchronized final void stop(){ + stop(0); + } + + @Override + public synchronized final void stop(final int delay){ + if(running){ + running = false; + server.stop(delay); + } + } + + // endregion + + @SuppressWarnings("StringBufferReplaceableByString") + @Override + public String toString(){ + final StringBuilder OUT = new StringBuilder(); + OUT.append("SimpleHttpsServer") .append('{'); + OUT.append("httpServer") .append('=') .append(server) .append(", "); + OUT.append("httpsConfigurator") .append('=') .append(getHttpsConfigurator()) .append(", "); + OUT.append("contexts") .append('=') .append(contexts) .append(", "); + OUT.append("address") .append('=') .append(getAddress()) .append(", "); + OUT.append("executor") .append('=') .append(getExecutor()); + OUT.append('}'); + return OUT.toString(); + } + + // start slash; no end slash + private static String getContext(final String path){ + final String linSlash = path.replace("\\","/"); + if(linSlash.equals("/")) return "/"; + final String seSlash = (!linSlash.startsWith("/") ? "/" : "") + linSlash + (!linSlash.endsWith("/") ? "/" : ""); + return seSlash.substring(0,seSlash.length()-1); + } + +} From c6fa1b031ce46eb0c7c0c359d03807054bb26b6e Mon Sep 17 00:00:00 2001 From: Katsute Date: Sun, 10 May 2020 13:19:45 -0400 Subject: [PATCH 4/5] Bug fixes & toString unfinal --- .../simplehttpserver/HttpSessionHandler.java | 11 ++-- .../simplehttpserver/SimpleHttpCookie.java | 60 +++++++------------ .../SimpleHttpExchangeImpl.java | 2 +- .../simplehttpserver/SimpleHttpServer.java | 8 +-- .../SimpleHttpServerImpl.java | 2 +- .../simplehttpserver/SimpleHttpsServer.java | 8 +-- .../SimpleHttpsServerImpl.java | 3 +- .../handler/ThrottledHandler.java | 1 + 8 files changed, 39 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/HttpSessionHandler.java b/src/main/java/com/kttdevelopment/simplehttpserver/HttpSessionHandler.java index 94c7163..b68b618 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/HttpSessionHandler.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/HttpSessionHandler.java @@ -4,7 +4,6 @@ import com.sun.net.httpserver.HttpExchange; import java.util.*; -import java.util.function.Predicate; /** * This class assigns {@link HttpSession} to every client. @@ -132,12 +131,12 @@ public synchronized final void updateLastAccessTime(){ @SuppressWarnings("StringBufferReplaceableByString") @Override - public final String toString(){ + public String toString(){ final StringBuilder OUT = new StringBuilder(); - OUT.append("HttpSession").append('{'); - OUT.append("sessionID").append('=').append(sessionID).append(", "); - OUT.append("creationTime").append('=').append(creationTime).append(", "); - OUT.append("lastAccessTime").append('=').append(lastAccessTime); + OUT.append("HttpSession") .append('{'); + OUT.append("sessionID") .append('=') .append(sessionID) .append(", "); + OUT.append("creationTime") .append('=') .append(creationTime) .append(", "); + OUT.append("lastAccessTime") .append('=') .append(lastAccessTime); OUT.append('}'); return OUT.toString(); } diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpCookie.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpCookie.java index 4097878..1565a2e 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpCookie.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpCookie.java @@ -30,8 +30,6 @@ public class SimpleHttpCookie { /** * Creates an HTTP cookie. All fields except for name, secure, httpOnly, and value can be set to null if unused. * - * @deprecated Use {@link Builder} class instead. This method will be removed in the future - * * @param name name of the cookie * @param value value of the cookie * @param domain what domain to send the cookie to @@ -45,8 +43,7 @@ public class SimpleHttpCookie { * @since 02.00.00 * @author Ktt Development */ - @Deprecated - public SimpleHttpCookie(final String name, final String value, final String domain, final String path, final String sameSite, final Date expires, final Integer maxAge, final Boolean secure, final Boolean httpOnly){ + private SimpleHttpCookie(final String name, final String value, final String domain, final String path, final String sameSite, final Date expires, final Integer maxAge, final Boolean secure, final Boolean httpOnly){ if(name == null) throw new NullPointerException("Cookie name can not be null"); else @@ -64,41 +61,7 @@ public SimpleHttpCookie(final String name, final String value, final String doma this.httpOnly = httpOnly; } - /** - * Converts the cookie to a readable string for the cookie header. - * - * @deprecated Use {@link #toCookieHeaderString()} instead - * - * @return cookie header - * - * @see SimpleHttpExchange#setCookie(SimpleHttpCookie) - * @since 02.00.00 - * @author Ktt Development - */ - @SuppressWarnings({"ConstantConditions", "SpellCheckingInspection"}) - @Override @Deprecated - public final String toString(){ - final StringBuilder OUT = new StringBuilder(); - - OUT.append(name).append("=").append(value); - if(expires != null) - OUT.append("; Expires=").append(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(expires)).append(" GMT"); - if(maxAge != null) - OUT.append("; Max-Age=").append(maxAge); - if(domain != null) - OUT.append("; Domain=").append(domain); - if(path != null) - OUT.append("; Path=").append(path); - if(secure != null && secure) - OUT.append("; Secure=").append(secure); - if(httpOnly != null && httpOnly) - OUT.append("; HttpOnly=").append(httpOnly); - if(sameSite != null) - OUT.append("; SameSite=").append(sameSite); - - return OUT.toString(); - } - + @SuppressWarnings("SpellCheckingInspection") private final SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss"); /** @@ -130,6 +93,25 @@ public final String toCookieHeaderString(){ return OUT.toString(); } + @SuppressWarnings("StringBufferReplaceableByString") + public String toString(){ + final StringBuilder OUT = new StringBuilder(); + + OUT.append("SimpleHttpCookie") .append('{'); + OUT.append("name") .append('=') .append(name) .append(", "); + OUT.append("value") .append('=') .append(value) .append(", "); + OUT.append("expires") .append('=') .append(expires) .append(", "); + OUT.append("maxAge") .append('=') .append(maxAge) .append(", "); + OUT.append("domain") .append('=') .append(domain) .append(", "); + OUT.append("path") .append('=') .append(path) .append(", "); + OUT.append("secure") .append('=') .append(secure) .append(", "); + OUT.append("httpOnly") .append('=') .append(httpOnly) .append(", "); + OUT.append("sameSite") .append('=') .append(sameSite); + OUT.append('}'); + + return OUT.toString(); + } + /** * Builder class for {@link SimpleHttpCookie}. * diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchangeImpl.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchangeImpl.java index 7be8f09..3862dd5 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchangeImpl.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchangeImpl.java @@ -417,7 +417,7 @@ public synchronized final void setAttribute(final String name, final Object valu @SuppressWarnings("StringBufferReplaceableByString") @Override - public final String toString(){ + public String toString(){ final StringBuilder OUT = new StringBuilder(); OUT.append("SimpleHttpExchange").append('{'); OUT.append("httpServer") .append('=') .append(httpServer) .append(", "); diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java index 0233139..4cf2c24 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java @@ -26,7 +26,7 @@ public abstract class SimpleHttpServer { /** * Create an empty {@link SimpleHttpServer}. Applications don't use this method. * - * @see SimpleHttpServerImpl#create(Integer, Integer) + * @see SimpleHttpServerImpl#createHttpServer(Integer, Integer) * @since 02.00.00 * @author Ktt Development */ @@ -44,7 +44,7 @@ public abstract class SimpleHttpServer { * @author Ktt Development */ public static SimpleHttpServer create() throws IOException { - return SimpleHttpServerImpl.create(null,null); + return SimpleHttpServerImpl.createHttpServer(null, null); } /** @@ -61,7 +61,7 @@ public static SimpleHttpServer create() throws IOException { * @author Ktt Development */ public static SimpleHttpServer create(final int port) throws IOException { - return SimpleHttpServerImpl.create(port,null); + return SimpleHttpServerImpl.createHttpServer(port, null); } /** @@ -79,7 +79,7 @@ public static SimpleHttpServer create(final int port) throws IOException { * @author Ktt Development */ public static SimpleHttpServer create(final int port, final int backlog) throws IOException { - return SimpleHttpServerImpl.create(port,backlog); + return SimpleHttpServerImpl.createHttpServer(port,backlog); } // diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServerImpl.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServerImpl.java index 69fe38d..a8d882a 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServerImpl.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServerImpl.java @@ -40,7 +40,7 @@ final class SimpleHttpServerImpl extends SimpleHttpServer { * @since 03.04.00 * @author Ktt Development */ - static SimpleHttpServer create(final Integer port, final Integer backlog) throws IOException{ + static SimpleHttpServer createHttpServer(final Integer port, final Integer backlog) throws IOException{ return new SimpleHttpServerImpl(port,backlog); } diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java index 433da79..8cafe8f 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServer.java @@ -22,7 +22,7 @@ public abstract class SimpleHttpsServer extends SimpleHttpServer { /** * Create an empty {@link SimpleHttpsServer}. Applications don't use this method. * - * @see SimpleHttpsServerImpl#create(Integer, Integer) + * @see SimpleHttpsServerImpl#createSimpleHttpsServer(Integer, Integer) * @since 02.00.00 * @author Ktt Development */ @@ -40,7 +40,7 @@ public abstract class SimpleHttpsServer extends SimpleHttpServer { * @author Ktt Development */ public static SimpleHttpsServer create() throws IOException { - return SimpleHttpsServerImpl.create(null,null); + return SimpleHttpsServerImpl.createSimpleHttpsServer(null, null); } /** @@ -57,7 +57,7 @@ public static SimpleHttpsServer create() throws IOException { * @author Ktt Development */ public static SimpleHttpsServer create(final int port) throws IOException { - return SimpleHttpsServerImpl.create(port,null); + return SimpleHttpsServerImpl.createSimpleHttpsServer(port, null); } /** @@ -75,7 +75,7 @@ public static SimpleHttpsServer create(final int port) throws IOException { * @author Ktt Development */ public static SimpleHttpsServer create(final int port, final int backlog) throws IOException { - return SimpleHttpsServerImpl.create(port,backlog); + return SimpleHttpsServerImpl.createSimpleHttpsServer(port,backlog); } // diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java index 96b6ea2..bd39e33 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java @@ -39,7 +39,7 @@ final public class SimpleHttpsServerImpl extends SimpleHttpsServer { * @since 03.04.00 * @author Ktt Development */ - static SimpleHttpsServer create(final Integer port, final Integer backlog) throws IOException{ + static SimpleHttpsServer createSimpleHttpsServer(final Integer port, final Integer backlog) throws IOException{ return new SimpleHttpsServerImpl(port,backlog); } @@ -74,6 +74,7 @@ public final HttpsConfigurator getHttpsConfigurator(){ // region copySimpleHttpServerImpl + @SuppressWarnings("SpellCheckingInspection") @Override public synchronized final InetSocketAddress bind(final int port) throws IOException{ final InetSocketAddress addr = new InetSocketAddress(port); diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/handler/ThrottledHandler.java b/src/main/java/com/kttdevelopment/simplehttpserver/handler/ThrottledHandler.java index 13cdd10..a9a66e9 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/handler/ThrottledHandler.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/handler/ThrottledHandler.java @@ -46,6 +46,7 @@ public final void handle(final HttpExchange exchange) throws IOException{ } } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString(){ final StringBuilder OUT = new StringBuilder(); From e65961b3f2f306de3e6168184c7adbeded3d8f7d Mon Sep 17 00:00:00 2001 From: Katsute Date: Sun, 10 May 2020 13:21:11 -0400 Subject: [PATCH 5/5] Update SimpleHttpsServerImpl.java --- .../kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java index bd39e33..6425653 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpsServerImpl.java @@ -82,6 +82,7 @@ public synchronized final InetSocketAddress bind(final int port) throws IOExcept return addr; } + @SuppressWarnings("SpellCheckingInspection") @Override public synchronized final InetSocketAddress bind(final int port, final int backlog) throws IOException{ final InetSocketAddress addr = new InetSocketAddress(port); @@ -89,11 +90,13 @@ public synchronized final InetSocketAddress bind(final int port, final int backl return addr; } + @SuppressWarnings("SpellCheckingInspection") @Override public synchronized final void bind(final InetSocketAddress addr) throws IOException{ server.bind(addr,0); } + @SuppressWarnings("SpellCheckingInspection") @Override public synchronized final void bind(final InetSocketAddress addr, final int backlog) throws IOException{ server.bind(addr,backlog);