::iterator ix;
+ ix = sessions.find(sessionId);
+ httpSession = ix->second;
+ if(ix == sessions.end()) {
+ httpSession = createHTTPSession();
+ httpRequest.response.setCookie("sessionId", httpSession->getSessionId());
+ }
+ core::Log(core::LOG_DEBUG_1) << "http session: " << "(" << sessionId << ") " << httpSession;
+
} else {
httpSession = createHTTPSession();
- response.setCookie("sessionId", httpSession->getSessionId());
+ httpRequest.response.setCookie("sessionId", httpSession->getSessionId());
}
return httpSession;
}
diff --git a/HTTPSessions.h b/HTTPSessions.h
index 7645fa9..3e904a2 100644
--- a/HTTPSessions.h
+++ b/HTTPSessions.h
@@ -1,8 +1,7 @@
#ifndef __HTTPSessions_h__
#define __HTTPSessions_h__
-#include "Header.h"
-#include "Response.h"
+#include "HTTPRequest.h"
namespace http {
@@ -11,8 +10,8 @@ namespace http {
class HTTPSessions {
public:
- HTTPSession * findSessionByHeader(core::Header &header, core::Response &response);
- HTTPSession * findSessionById(std::string sessionId, core::Response &response);
+ HTTPSession * findSessionByHeader(HTTPRequest &httpRequest);
+ HTTPSession * findSessionById(std::string sessionId, HTTPRequest &httpRequest);
private:
HTTPSession * createHTTPSession();
diff --git a/Release/main.cpp.o b/Release/main.cpp.o
index 24af4fa..d49486f 100644
Binary files a/Release/main.cpp.o and b/Release/main.cpp.o differ
diff --git a/Release/main.cpp.o.d b/Release/main.cpp.o.d
index 626f018..28a48a1 100644
--- a/Release/main.cpp.o.d
+++ b/Release/main.cpp.o.d
@@ -7,9 +7,11 @@ Release/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
../ServerCore/TCPServerSocket.h ../ServerCore/Service.h \
../ServerCore/CommandList.h ../ServerCore/EPoll.h \
../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
- ../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h _GET.h \
- ../ServerCore/Command.h ../ServerCore/Session.h ../ServerCore/Header.h \
- ../ServerCore/Response.h _POST.h
+ ../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \
+ HTTPSessions.h ../ServerCore/Header.h ../ServerCore/Response.h \
+ HTTPPageList.h ../ServerCore/Session.h __index.h HTTPPage.h \
+ HTTPSession.h __script.h __style.h __setupadmin.h __favicon_ico.h \
+ __welcome.h HTTPHandler.h ../ServerCore/Command.h
../ServerCore/includes:
@@ -59,14 +61,32 @@ HTTPService.h:
../ServerCore/Service.h:
-_GET.h:
-
-../ServerCore/Command.h:
-
-../ServerCore/Session.h:
+HTTPSessions.h:
../ServerCore/Header.h:
../ServerCore/Response.h:
-_POST.h:
+HTTPPageList.h:
+
+../ServerCore/Session.h:
+
+__index.h:
+
+HTTPPage.h:
+
+HTTPSession.h:
+
+__script.h:
+
+__style.h:
+
+__setupadmin.h:
+
+__favicon_ico.h:
+
+__welcome.h:
+
+HTTPHandler.h:
+
+../ServerCore/Command.h:
diff --git a/__editbiew.js b/__editbiew.js
new file mode 100644
index 0000000..fcabf39
--- /dev/null
+++ b/__editbiew.js
@@ -0,0 +1,307 @@
+
+
+ var mainpage;
+ var result;
+ var mousedownx;
+ var mousedowny;
+ var mouseDownWidth;
+ var mouseDownHeight;
+ var ismousedown = false;
+ var dragobject;
+ var dragHint = "move";
+ var data;
+ var showGrid = false;
+ var snapToGrid = false;
+ var gridSize = 10;
+ var selected;
+ var itemparameters;
+
+ function init() {
+ mainpage = document.getElementById("mainpage");
+ data = document.getElementById("data");
+ itemparameters = document.getElementById("itemparameters");
+ var gridsize = document.getElementById("gridsize");
+ gridsize.value = gridSize;
+ drawGrid();
+ }
+
+ function drawGrid() {
+ var grid = document.getElementById("grid");
+ var context = grid.getContext("2d");
+ if(showGrid == true) {
+ context.clearRect(0,0,grid.width,grid.height);
+ context.globalAlpha = 0.2;
+ context.lineWidth = 0.5;
+ for(ix = 0; ix < grid.width; ix += gridSize) {
+ context.beginPath();
+ context.moveTo(ix, 0);
+ context.lineTo(ix, grid.height);
+ context.stroke();
+ context.beginPath();
+ context.moveTo(0, ix);
+ context.lineTo(grid.width, ix);
+ context.stroke();
+ }
+ } else {
+ context.clearRect(0,0,grid.width,grid.height);
+ }
+ }
+
+ function setDragHint(hint) {
+ dragHint = hint;
+ }
+
+ function getMouseX(e) {
+ return e.clientX - mainpage.offsetLeft - parseFloat(mainpage.style.borderWidth);
+ }
+
+ function getMouseY(e) {
+ return e.clientY - mainpage.offsetTop - parseFloat(mainpage.style.borderWidth);
+ }
+
+ function mousedown(obj, e) {
+ var mouseX = getMouseX(e);
+ var mouseY = getMouseY(e);
+ mousedownx = mouseX - obj.offsetLeft;
+ mousedowny = mouseY - obj.offsetTop;
+ mouseDownLeft = parseFloat(obj.style.left);
+ mouseDownTop = parseFloat(obj.style.top);
+ mouseDownWidth = parseFloat(obj.style.width);
+ mouseDownHeight = parseFloat(obj.style.height);
+ dragobject = obj;
+ selected = obj;
+ ismousedown = true;
+ displayParameters();
+ }
+
+ function mouseup() {
+ ismousedown = false;
+ dragobject = null;
+ console.log(mainpage.innerHTML);
+ }
+
+ function mousemove(e) {
+ var mouseX = getMouseX(e);
+ var mouseY = getMouseY(e);
+ if(ismousedown) {
+
+ if(dragHint == "move") {
+ if(snapToGrid == false) {
+ dragobject.style.left = (mouseX - mousedownx) + "px";
+ dragobject.style.top = (mouseY - mousedowny) + "px";
+ } else {
+ dragobject.style.left = (Math.round((mouseX - mousedownx) / gridSize) * gridSize) + "px";
+ dragobject.style.top = (Math.round((mouseY - mousedowny) / gridSize) * gridSize) + "px";
+ }
+ if((mouseX - mousedownx) < 0)
+ dragobject.style.left = "0px";
+ if((mouseY - mousedowny) < 0)
+ dragobject.style.top = "0px";
+ if((mouseX - mousedownx + parseFloat(dragobject.style.width)) > parseFloat(mainpage.style.width))
+ dragobject.style.left = (mouseX - mousedownx) + "px";
+ } else if(dragHint == "rightbottomresize") {
+ dragobject.style.width = (mouseX - mouseDownLeft) + "px";
+ dragobject.style.height = (mouseY - mouseDownTop) + "px";
+ } else if(dragHint == "rightresize") {
+ if(snapToGrid == false) {
+ dragobject.style.width = (mouseX - mouseDownLeft) + "px";
+ } else {
+ dragobject.style.width = (Math.round((mouseX - mouseDownLeft) / gridSize) * gridSize) + "px";
+ }
+ } else if(dragHint == "bottomresize") {
+ if(snapToGrid == false) {
+ dragobject.style.height = (mouseY - mouseDownTop) + "px";
+ } else {
+ dragobject.style.height = (Math.round((mouseY - mouseDownTop) / gridSize) * gridSize) + "px";
+ }
+ } else if(dragHint == "leftresize") {
+ dragobject.style.left = mouseX + "px";
+ dragobject.style.width = (mouseDownWidth + (mouseDownLeft - mouseX)) + "px";
+ } else if(dragHint == "topresize") {
+ dragobject.style.top = mouseY + "px";
+ dragobject.style.height = (mouseDownHeight + (mouseDownTop - mouseY)) + "px";
+ }
+
+ data.innerHTML = "" + dragobject.nodeName + "
" +
+ "Action: " + dragHint + "
" +
+ "MouseLocation: " + mouseX + ":" + mouseY + "
" +
+ "MouseOver Location: " + (mouseX - dragobject.offsetLeft) + ":" + (mouseY - dragobject.offsetTop) + "
" +
+ "Location: " + dragobject.style.left + ":" + dragobject.style.top + "
" +
+ "Size: " + dragobject.style.width + ":" + dragobject.style.height + "
" +
+ "
";
+
+
+ } else {
+ var mouseabove = document.elementFromPoint(mouseX + mainpage.offsetLeft, mouseY + mainpage.offsetTop);
+
+ if((mouseabove.id != "mainpage") && (mouseabove.id != "grid")) {
+
+ data.innerHTML = "" + mouseabove.nodeName + "
" +
+ "Action: " + dragHint + "
" +
+ "MouseLocation: " + mouseX + ":" + mouseY + "
" +
+ "MouseOver Location: " + (mouseX - mouseabove.offsetLeft) + ":" + (mouseY - mouseabove.offsetTop) + "
" +
+ "Location: " + mouseabove.style.left + ":" + mouseabove.style.top + "
" +
+ "Size: " + mouseabove.style.width + ":" + mouseabove.style.height + "
" +
+ "
";
+
+ if((mouseabove.nodeName == "DIV") ||
+ (mouseabove.nodeName == "IMG") ||
+ (mouseabove.nodeName == "BUTTON") ||
+ (mouseabove.nodeName == "INPUT") ||
+ (mouseabove.nodeName == "SPAN")) {
+
+ if((parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) &&
+ (parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {
+ mouseabove.style.cursor = "nwse-resize";
+ dragHint = "rightbottomresize";
+ } else if((parseFloat(mouseabove.style.left) <= (mouseX - mouseabove.offsetLeft)) &&
+ ((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop))) {
+ mouseabove.style.cursor = "nesw-resize";
+ dragHint = "righttopresize";
+ } else if(((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) &&
+ (parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {
+ mouseabove.style.cursor = "nesw-resize";
+ dragHint = "leftbottomresize";
+ } else if(parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) {
+ mouseabove.style.cursor = "ew-resize";
+ dragHint = "rightresize";
+ } else if(parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop)) {
+ mouseabove.style.cursor = "ns-resize";
+ dragHint = "bottomresize";
+ } else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) {
+ mouseabove.style.cursor = "ew-resize";
+ dragHint = "leftresize";
+ } else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop)) {
+ mouseabove.style.cursor = "ns-resize";
+ dragHint = "topresize";
+ } else {
+ mouseabove.style.cursor = "move";
+ dragHint = "move";
+ }
+ } else {
+ mouseabove.style.cursor = "default";
+ }
+ } else {
+ mouseabove.style.cursor = "default";
+ dragHint = "";
+ data.innerHTML = "";
+ }
+ }
+ displayParameters();
+ }
+
+ function displayParameters() {
+
+ itemparameters.innerHTML = "" + selected.nodeName + ": " + selected.id + "
" +
+ "Location: " + selected.style.left + ":" + selected.style.top + "
" +
+ "Size: " + selected.style.width + ":" + selected.style.height + "
" +
+ "
";
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
View Editor
+
+
+
+
+
+

+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
This is a text label
+
+
+
+
+
+
+
+
+
+
+
+
+
Toolbar
+
+
+
+
+
+
+
+
+
+
+
+
+
+