mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpinet] Add simple web server (#7527)
Also add EscapeHTML to HttpUtil.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "wpinet/MulticastServiceAnnouncer.h"
|
||||
#include "wpinet/MulticastServiceResolver.h"
|
||||
#include "wpinet/PortForwarder.h"
|
||||
#include "wpinet/WebServer.h"
|
||||
|
||||
using namespace wpi::java;
|
||||
|
||||
@@ -80,6 +81,31 @@ Java_edu_wpi_first_net_WPINetJNI_removePortForwarder
|
||||
wpi::PortForwarder::GetInstance().Remove(port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_net_WPINetJNI
|
||||
* Method: startWebServer
|
||||
* Signature: (ILjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_net_WPINetJNI_startWebServer
|
||||
(JNIEnv* env, jclass, jint port, jstring path)
|
||||
{
|
||||
wpi::WebServer::GetInstance().Start(static_cast<unsigned int>(port),
|
||||
JStringRef{env, path}.str());
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_net_WPINetJNI
|
||||
* Method: stopWebServer
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_net_WPINetJNI_stopWebServer
|
||||
(JNIEnv* env, jclass, jint port)
|
||||
{
|
||||
wpi::WebServer::GetInstance().Stop(port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_net_WPINetJNI
|
||||
* Method: createMulticastServiceAnnouncer
|
||||
|
||||
Reference in New Issue
Block a user