Update src/main/java/org/openautonomousconnection/webserver/api/WebPage.java
This commit is contained in:
@@ -1,57 +1,25 @@
|
|||||||
package org.openautonomousconnection.webserver.api;
|
# Open Autonomous Connection WebServer
|
||||||
|
|
||||||
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.resource.WebResourceResponsePacket;
|
This is the WebServer for our Open Autonomous Connection project.<br />
|
||||||
import org.w3c.dom.Document;
|
Feel free to join our Discord.
|
||||||
import org.w3c.dom.Element;
|
<br />
|
||||||
import org.w3c.dom.html.HTMLBodyElement;
|
|
||||||
import org.w3c.dom.html.HTMLDocument;
|
|
||||||
import org.w3c.dom.html.HTMLHeadElement;
|
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
## License Notice
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
|
|
||||||
/**
|
This project (OAC) is licensed under
|
||||||
* Server-side Java page (v1.0.1-BETA).
|
the [Open Autonomous Public License (OAPL)](https://open-autonomous-connection.org/license.html).
|
||||||
*
|
|
||||||
* <p>Every .java page must extend this class.</p>
|
|
||||||
*/
|
|
||||||
public abstract class WebPage {
|
|
||||||
|
|
||||||
private static final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
**Third-party components:**
|
||||||
|
<br />
|
||||||
|
Download all license here: https://open-autonomous-connection.org/assets/licenses.zip
|
||||||
|
- *UnlegitLibrary* is authored by the same copyright holder and is used here under a special agreement:
|
||||||
|
While [UnlegitLibrary](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/) is generally distributed under
|
||||||
|
the [GNU GPLv3](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/src/branch/master/LICENSE),
|
||||||
|
it is additionally licensed under OAPL **exclusively for the OAC project**.
|
||||||
|
Therefore, within OAC, the OAPL terms apply to UnlegitLibrary as well.
|
||||||
|
|
||||||
private static final DocumentBuilder documentBuilder;
|
# Bugs/Problems
|
||||||
|
|
||||||
static {
|
# In progress
|
||||||
try {
|
|
||||||
documentBuilder = factory.newDocumentBuilder();
|
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Document document;
|
# TODO
|
||||||
|
|
||||||
protected HTMLBodyElement body;
|
|
||||||
|
|
||||||
protected HTMLHeadElement head;
|
|
||||||
/**
|
|
||||||
* Default constructor that creates a new Document instance
|
|
||||||
*/
|
|
||||||
public WebPage() {
|
|
||||||
this.document = documentBuilder.newDocument();
|
|
||||||
|
|
||||||
this.head = (HTMLHeadElement) this.document.createElement("head");
|
|
||||||
|
|
||||||
this.body = (HTMLBodyElement) this.document.createElement("body");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles a web request.
|
|
||||||
*
|
|
||||||
* @param ctx context (client, request, session)
|
|
||||||
* @return resource response packet
|
|
||||||
* @throws Exception on unexpected failures
|
|
||||||
*/
|
|
||||||
public abstract WebResourceResponsePacket handle(WebPageContext ctx) throws Exception;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user