Advancing along here.
This commit is contained in:
parent
527d2f6f4d
commit
27f0c78b5b
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,4 +4,4 @@ Release
|
|||||||
*.o
|
*.o
|
||||||
*.o.d
|
*.o.d
|
||||||
*.mk
|
*.mk
|
||||||
|
.vscode/**
|
||||||
|
@ -14,7 +14,7 @@ namespace http {
|
|||||||
|
|
||||||
void onDataReceived(char *data, int len) override {
|
void onDataReceived(char *data, int len) override {
|
||||||
|
|
||||||
coreutils::Log(coreutils::LOG_DEBUG_1) << data;
|
// coreutils::Log(coreutils::LOG_DEBUG_1) << data;
|
||||||
|
|
||||||
protocol(std::string(data, len));
|
protocol(std::string(data, len));
|
||||||
send();
|
send();
|
||||||
|
@ -13,6 +13,8 @@ namespace http {
|
|||||||
public:
|
public:
|
||||||
bool check(std::string request) {
|
bool check(std::string request) {
|
||||||
if(request != "") {
|
if(request != "") {
|
||||||
|
if(request.find("?") != -1)
|
||||||
|
request = request.substr(0, request.find("?"));
|
||||||
if(name.length() > 0) {
|
if(name.length() > 0) {
|
||||||
if(name == request)
|
if(name == request)
|
||||||
return true;
|
return true;
|
||||||
|
BIN
HTTPServer
BIN
HTTPServer
Binary file not shown.
@ -2,6 +2,7 @@
|
|||||||
#define ____editview_h__
|
#define ____editview_h__
|
||||||
|
|
||||||
#include "HTTPPage.h"
|
#include "HTTPPage.h"
|
||||||
|
#include "File.h"
|
||||||
|
|
||||||
namespace http {
|
namespace http {
|
||||||
|
|
||||||
@ -23,7 +24,11 @@ namespace http {
|
|||||||
data << " <canvas id=\"grid\" width=\"600px\" height=\"600px\" style=\"position: absolute; left: 0px; top: 0px; alpha: 0.5; cursor: normal;\"></canvas>" << std::endl;
|
data << " <canvas id=\"grid\" width=\"600px\" height=\"600px\" style=\"position: absolute; left: 0px; top: 0px; alpha: 0.5; cursor: normal;\"></canvas>" << std::endl;
|
||||||
data << "" << std::endl;
|
data << "" << std::endl;
|
||||||
|
|
||||||
data << "<div id=\"__workspace__\"></div>" << std::endl;
|
coreutils::File workspace("/home/barant/jetserver/views/testview1.view");
|
||||||
|
workspace.read();
|
||||||
|
data << "<div id=\"__workspace__\">";
|
||||||
|
data << workspace.asString();
|
||||||
|
data << "</div>" << std::endl;
|
||||||
|
|
||||||
data << "" << std::endl;
|
data << "" << std::endl;
|
||||||
data << " <div id=\"window3\" style=\"position:absolute; top: 235px; left: 610px;" << std::endl;
|
data << " <div id=\"window3\" style=\"position:absolute; top: 235px; left: 610px;" << std::endl;
|
||||||
|
@ -14,7 +14,7 @@ namespace http {
|
|||||||
HTTPRequest *httpRequest,
|
HTTPRequest *httpRequest,
|
||||||
std::stringstream &data) override {
|
std::stringstream &data) override {
|
||||||
|
|
||||||
coreutils::Directory directory("/home/bradarant/jetserver/views");
|
coreutils::Directory directory("../../jetserver/views");
|
||||||
|
|
||||||
data << "<div>" << std::endl;
|
data << "<div>" << std::endl;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ namespace http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\"" << std::endl;
|
data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\"" << std::endl;
|
||||||
data << " onmousedown=\"getPage('/editview','main');\">" << std::endl;
|
data << " onmousedown=\"getPage('/editview?view=testview1','main');\">" << std::endl;
|
||||||
data << " <span>" << directory.get().getName() << "</span>" << std::endl;
|
data << " <span>" << directory.get().getName() << "</span>" << std::endl;
|
||||||
data << " </div>" << std::endl;
|
data << " </div>" << std::endl;
|
||||||
directory.next();
|
directory.next();
|
||||||
|
35
_image.h
Normal file
35
_image.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef ____editview_h__
|
||||||
|
#define ____editview_h__
|
||||||
|
|
||||||
|
#include "HTTPPage.h"
|
||||||
|
#include "File.h"
|
||||||
|
|
||||||
|
namespace http {
|
||||||
|
|
||||||
|
class _image : public HTTPPage {
|
||||||
|
|
||||||
|
bool test(std::string request) {
|
||||||
|
if(request.substr(0, 6) == "image/") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest *httpRequest, std::stringstream &data) override {
|
||||||
|
|
||||||
|
std::cout << ">>>" << request << std::endl;
|
||||||
|
|
||||||
|
coreutils::File workspace("/home/barant/jetserver/images/barant_web_logo.png");
|
||||||
|
workspace.read();
|
||||||
|
httpRequest->response.addHeader("Content-Length", workspace.asString().size().toString());
|
||||||
|
httpRequest->response.addHeader("Content-Type", "image/png");
|
||||||
|
httpRequest->response.body = workspace.asString();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
15
launch.json
Normal file
15
launch.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "C++ Launch (Windows)",
|
||||||
|
"type": "cppvsdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "C:\\app1\\Debug\\app1.exe",
|
||||||
|
"symbolSearchPath": "C:\\Symbols;C:\\SymbolDir2",
|
||||||
|
"externalConsole": true,
|
||||||
|
"logging": {
|
||||||
|
"moduleLoad": false,
|
||||||
|
"trace": true
|
||||||
|
},
|
||||||
|
"visualizerFile": "${workspaceFolder}/my.natvis",
|
||||||
|
"showDisplayString": true
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user