From 3f9aed74383ed43027dad4eb9a12eec88d7c479e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 14 Apr 2019 00:06:06 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Replace=20FreenetRequest=20with?= =?utf8?q?=20Kotlin=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/web/page/FreenetRequest.java | 78 ---------------------- .../pterodactylus/sone/web/page/FreenetRequest.kt | 25 +++++++ 2 files changed, 25 insertions(+), 78 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/sone/web/page/FreenetRequest.java create mode 100644 src/main/kotlin/net/pterodactylus/sone/web/page/FreenetRequest.kt diff --git a/src/main/java/net/pterodactylus/sone/web/page/FreenetRequest.java b/src/main/java/net/pterodactylus/sone/web/page/FreenetRequest.java deleted file mode 100644 index 5cf12d6..0000000 --- a/src/main/java/net/pterodactylus/sone/web/page/FreenetRequest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Sone - FreenetRequest.java - Copyright © 2011–2019 David Roden - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.pterodactylus.sone.web.page; - -import java.net.URI; - -import net.pterodactylus.util.web.Method; -import net.pterodactylus.util.web.Request; -import freenet.clients.http.ToadletContext; -import freenet.support.api.HTTPRequest; - -/** - * Encapsulates all Freenet-specific properties of a request. - */ -public class FreenetRequest extends Request { - - /** The underlying HTTP request from Freenet. */ - private final HTTPRequest httpRequest; - - /** The toadlet context. */ - private final ToadletContext toadletContext; - - /** - * Creates a new freenet request. - * - * @param uri - * The URI that is being accessed - * @param method - * The method used to access this page - * @param httpRequest - * The underlying HTTP request from Freenet - * @param toadletContext - * The toadlet context - */ - public FreenetRequest(URI uri, Method method, HTTPRequest httpRequest, ToadletContext toadletContext) { - super(uri, method); - this.httpRequest = httpRequest; - this.toadletContext = toadletContext; - } - - // - // ACCESSORS - // - - /** - * Returns the underlying HTTP request from Freenet. - * - * @return The underlying HTTP request from Freenet - */ - public HTTPRequest getHttpRequest() { - return httpRequest; - } - - /** - * Returns the toadlet context. - * - * @return The toadlet context - */ - public ToadletContext getToadletContext() { - return toadletContext; - } - -} diff --git a/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetRequest.kt b/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetRequest.kt new file mode 100644 index 0000000..00424ff --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetRequest.kt @@ -0,0 +1,25 @@ +/* + * Sone - FreenetRequest.java - Copyright © 2011–2019 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.web.page + +import freenet.clients.http.* +import freenet.support.api.* +import net.pterodactylus.util.web.* +import java.net.* + +class FreenetRequest(uri: URI, method: Method, val httpRequest: HTTPRequest, val toadletContext: ToadletContext) : Request(uri, method) -- 2.7.4