Update src/main/java/org/openautonomousconnection/webserver/api/WebPage.java

This commit is contained in:
2026-03-02 16:32:28 +00:00
parent 0a821fc8e5
commit 14e2af25d6

View File

@@ -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;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.html.HTMLBodyElement;
import org.w3c.dom.html.HTMLDocument;
import org.w3c.dom.html.HTMLHeadElement;
This is the WebServer for our Open Autonomous Connection project.<br />
Feel free to join our Discord.
<br />
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
## License Notice
/**
* Server-side Java page (v1.0.1-BETA).
*
* <p>Every .java page must extend this class.</p>
*/
public abstract class WebPage {
This project (OAC) is licensed under
the [Open Autonomous Public License (OAPL)](https://open-autonomous-connection.org/license.html).
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 {
try {
documentBuilder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
}
}
# In progress
protected Document document;
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;
}
# TODO