diff --git a/CMakeLists.txt b/CMakeLists.txt index f80b4e7..133582f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(PythonInterp REQUIRED) if (CMAKE_COMPILER_IS_GNUCXX) add_definitions(-Wall -ansi -Wno-deprecated -pthread) endif () +add_definitions(-DMG_ENABLE_HTTP_STREAMING_MULTIPART) #------------------- # set common include folder for module diff --git a/Dockerfile b/Dockerfile index 26c1183..a3b651b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ENV COVERALLS_SERVICE_NAME=$travis_service WORKDIR fiuba-taller2-tallerify-app-server WORKDIR build -RUN $HOME/usr/bin/cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug .. +RUN $HOME/usr/bin/cmake -DCOVERALLS=OFF -DCMAKE_BUILD_TYPE=Debug .. RUN make CMD ["./fiuba_taller2_tallerify_app_server", "0.0.0.0"] diff --git a/conf.py b/conf.py index e50864c..e767274 100644 --- a/conf.py +++ b/conf.py @@ -54,9 +54,9 @@ # built documents. # # The short X.Y version. -version = u'0.2.0' +version = u'0.2.1' # The full version, including alpha/beta/rc tags. -release = u'0.2.0' +release = u'0.2.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/.buildinfo b/doc/.buildinfo index 1a8911c..a5df127 100644 --- a/doc/.buildinfo +++ b/doc/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: b4f4b76259434676a5e1fbaf29f24dde +config: 5d2bb56954f7653c3522193763a0cb8f tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/doc/.doctrees/doc/rst/controller.doctree b/doc/.doctrees/doc/rst/controller.doctree index 61dc5a1..b3da1c5 100644 Binary files a/doc/.doctrees/doc/rst/controller.doctree and b/doc/.doctrees/doc/rst/controller.doctree differ diff --git a/doc/.doctrees/doc/rst/json_response.doctree b/doc/.doctrees/doc/rst/json_response.doctree index 2089bac..d7309e0 100644 Binary files a/doc/.doctrees/doc/rst/json_response.doctree and b/doc/.doctrees/doc/rst/json_response.doctree differ diff --git a/doc/.doctrees/doc/rst/request.doctree b/doc/.doctrees/doc/rst/request.doctree index 19c43d0..f4725e5 100644 Binary files a/doc/.doctrees/doc/rst/request.doctree and b/doc/.doctrees/doc/rst/request.doctree differ diff --git a/doc/.doctrees/doc/rst/tracks_controller.doctree b/doc/.doctrees/doc/rst/tracks_controller.doctree index 23b1c1a..434e34a 100644 Binary files a/doc/.doctrees/doc/rst/tracks_controller.doctree and b/doc/.doctrees/doc/rst/tracks_controller.doctree differ diff --git a/doc/.doctrees/environment.pickle b/doc/.doctrees/environment.pickle index 2f38d95..8ae8fa7 100644 Binary files a/doc/.doctrees/environment.pickle and b/doc/.doctrees/environment.pickle differ diff --git a/doc/.doctrees/index.doctree b/doc/.doctrees/index.doctree index 024f0a6..41dcc1c 100644 Binary files a/doc/.doctrees/index.doctree and b/doc/.doctrees/index.doctree differ diff --git a/doc/doc/rst/controller.html b/doc/doc/rst/controller.html index 2c9cb95..47cb13f 100644 --- a/doc/doc/rst/controller.html +++ b/doc/doc/rst/controller.html @@ -8,7 +8,7 @@ - Controller — Tallerify App Server 0.2.0 documentation + Controller — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -169,7 +169,7 @@

Controller
class Controller
-

Subclassed by PingController, TracksController

+

Subclassed by PingController, PlayController, TracksController

Public Functions

@@ -294,7 +294,7 @@

Controller var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/json_response.html b/doc/doc/rst/json_response.html index a9b6acc..51ef0ac 100644 --- a/doc/doc/rst/json_response.html +++ b/doc/doc/rst/json_response.html @@ -8,7 +8,7 @@ - JSONResponse — Tallerify App Server 0.2.0 documentation + JSONResponse — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -243,7 +243,7 @@

JSONResponse var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/mongo_dao.html b/doc/doc/rst/mongo_dao.html index e50e096..a7dec99 100644 --- a/doc/doc/rst/mongo_dao.html +++ b/doc/doc/rst/mongo_dao.html @@ -8,7 +8,7 @@ - MongoDao — Tallerify App Server 0.2.0 documentation + MongoDao — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -260,7 +260,7 @@

MongoDao var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/ping_controller.html b/doc/doc/rst/ping_controller.html index 56df76f..b1ef190 100644 --- a/doc/doc/rst/ping_controller.html +++ b/doc/doc/rst/ping_controller.html @@ -8,7 +8,7 @@ - PingController — Tallerify App Server 0.2.0 documentation + PingController — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -247,7 +247,7 @@

PingController var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/request.html b/doc/doc/rst/request.html index 46f66c0..8775365 100644 --- a/doc/doc/rst/request.html +++ b/doc/doc/rst/request.html @@ -8,7 +8,7 @@ - Request — Tallerify App Server 0.2.0 documentation + Request — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -185,6 +185,21 @@

Request +
+Request(mg_connection *connection, int event, void *eventData)
+

Request constructor for multipart requests

+
Parameters
+
    +
  • connection:
  • +
  • event:
  • +
  • eventData:
  • +
+
+
+

+

+
~Request()
@@ -270,6 +285,69 @@

Request +
+mg_connection *getConnection() const
+

Get the associated connection

+
Return
+
the connection
+
+

+

+ +
+
+http_message *getHttpMessage() const
+

Get the original http message

+
Return
+
the http message
+
+

+
+ +
+
+const std::string &getElementIdString() const
+

Get the element id as string

+
Return
+
element id as string
+
+

+
+ +
+
+void setElementIdString(const std::string &elementIdString)
+

Set the elementId as a string

+
Parameters
+
    +
  • elementIdString: to set
  • +
+
+
+

+
+ +
+
+int getEvent() const
+

Event getter

+
Return
+
the event code
+
+

+
+ +
+
+void *getEventData() const
+

Event data getter

+
Return
+
the event data as void*
+
+

+
+
@@ -319,7 +397,7 @@

Request var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/response.html b/doc/doc/rst/response.html index 8fcda9e..efcfecd 100644 --- a/doc/doc/rst/response.html +++ b/doc/doc/rst/response.html @@ -8,7 +8,7 @@ - Response — Tallerify App Server 0.2.0 documentation + Response — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -247,7 +247,7 @@

Response var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/server.html b/doc/doc/rst/server.html index 676dae2..6a746aa 100644 --- a/doc/doc/rst/server.html +++ b/doc/doc/rst/server.html @@ -8,7 +8,7 @@ - Server — Tallerify App Server 0.2.0 documentation + Server — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -66,7 +66,7 @@
- 0.2.0 + 0.2.1
@@ -252,7 +252,7 @@

Server var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', - VERSION:'0.2.0', + VERSION:'0.2.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, diff --git a/doc/doc/rst/track.html b/doc/doc/rst/track.html index f9b2db7..b1b6a00 100644 --- a/doc/doc/rst/track.html +++ b/doc/doc/rst/track.html @@ -8,7 +8,7 @@ - Track — Tallerify App Server 0.2.0 documentation + Track — Tallerify App Server 0.2.1 documentation @@ -35,7 +35,7 @@ - + @@ -65,7 +65,7 @@
- 0.2.0 + 0.2.1
@@ -257,7 +257,7 @@

Track @@ -65,7 +65,7 @@
- 0.2.0 + 0.2.1
@@ -252,19 +252,31 @@

R

  • Request (C++ class)
  • Request::getBody (C++ function) +
  • +
  • Request::getConnection (C++ function)
  • Request::getElementId (C++ function) +
  • +
  • Request::getElementIdString (C++ function) +
  • +
  • Request::getEvent (C++ function) +
  • +
  • Request::getEventData (C++ function) +
  • +
  • Request::getHttpMessage (C++ function)
  • Request::getHttpVerb (C++ function)
  • Request::getUrl (C++ function)
  • -
  • Request::Request (C++ function) + + -
      +
    • Request::setElementIdString (C++ function) +
    • Request::setUrl (C++ function)
    • Request::writeResponse (C++ function) @@ -321,9 +333,11 @@

      T

    • TracksController::handles (C++ function)
    • -
    • TracksController::post (C++ function) +
    • TracksController::post (C++ function)
    • TracksController::process (C++ function) +
    • +
    • TracksController::setFileName (C++ function)
    • TracksController::TracksController (C++ function)
    • @@ -368,7 +382,7 @@

      T

      + + + + + + + +
      +
      + + + + + + +
      +
      Tallerify App Server +
      +
      +
      + + + + + + + + +
      +
      + + +
      + +
      + + +
      +
      + +
      +
      PlayController.h File Reference
      +
      +
      +
      #include <regex>
      +#include "Controller.h"
      +#include "../networking/JSONResponse.h"
      +
      +

      Go to the source code of this file.

      + + + + +

      +Classes

      class  PlayController
       
      +
      + + + + diff --git a/doc/html/_play_controller_8h_source.html b/doc/html/_play_controller_8h_source.html new file mode 100644 index 0000000..0c6e6e7 --- /dev/null +++ b/doc/html/_play_controller_8h_source.html @@ -0,0 +1,87 @@ + + + + + + + +Tallerify App Server: src/api/controllers/PlayController.h Source File + + + + + + + + + +
      +
      + + + + + + +
      +
      Tallerify App Server +
      +
      +
      + + + + + + + + +
      +
      + + +
      + +
      + + +
      +
      +
      +
      PlayController.h
      +
      +
      +Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_PLAYCONTROLLER_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_PLAYCONTROLLER_H
      5 
      6 #include <regex>
      7 #include "Controller.h"
      8 #include "../networking/JSONResponse.h"
      9 
      13 class PlayController : public Controller {
      14 public:
      19 
      23  virtual ~PlayController();
      24 
      31  bool handles(std::string method, std::string url);
      32 
      38  Response *process(Request &request);
      39 
      45  void get(Request &request, JSONResponse &response);
      46 
      47 private:
      48  std::regex playRegex;
      49 };
      50 
      51 
      52 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_PLAYCONTROLLER_H
      Response * process(Request &request)
      Definition: PlayController.cpp:19
      +
      bool handles(std::string method, std::string url)
      Definition: PlayController.cpp:15
      +
      virtual ~PlayController()
      Definition: PlayController.cpp:11
      +
      Definition: PlayController.h:13
      + +
      Definition: Request.h:13
      +
      Definition: JSONResponse.h:13
      +
      PlayController()
      Definition: PlayController.cpp:6
      +
      Definition: Controller.h:14
      +
      Definition: Response.h:12
      +
      + + + + diff --git a/doc/html/_request_8h_source.html b/doc/html/_request_8h_source.html index 74e5371..0a4c59e 100644 --- a/doc/html/_request_8h_source.html +++ b/doc/html/_request_8h_source.html @@ -66,18 +66,24 @@
      Request.h
      -Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      5 
      6 
      7 #include <mongoose/mongoose.h>
      8 #include "Response.h"
      9 
      13 class Request {
      14 public:
      22  Request(mg_connection *connection, http_message *httpMessage);
      23 
      27  virtual ~Request();
      28 
      33  virtual void writeResponse(Response *response);
      34 
      39  virtual const std::string &getUrl() const;
      40 
      45  virtual const std::string &getBody() const;
      46 
      51  virtual const std::string &getHttpVerb() const;
      52 
      57  int getElementId() const;
      58 
      63  void setElementId(int elementId);
      64 
      69  void setUrl(const std::string &url);
      70 
      71 private:
      72  mg_connection *connection;
      73  std::string url;
      74  std::string body;
      75  std::string httpVerb;
      76  int elementId;
      77 private:
      78 
      79  void parseMessage(http_message *httpMessage);
      80 };
      81 
      82 
      83 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      int getElementId() const
      Definition: Request.cpp:47
      -
      virtual const std::string & getHttpVerb() const
      Definition: Request.cpp:43
      -
      void setElementId(int elementId)
      Definition: Request.cpp:51
      -
      void setUrl(const std::string &url)
      Definition: Request.cpp:55
      +Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      5 
      6 
      7 #include <mongoose/mongoose.h>
      8 #include "Response.h"
      9 
      13 class Request {
      14 public:
      22  Request(mg_connection *connection, http_message *httpMessage);
      23 
      30  Request(mg_connection *connection, int event, void *eventData);
      31 
      35  virtual ~Request();
      36 
      41  virtual void writeResponse(Response *response);
      42 
      47  virtual const std::string &getUrl() const;
      48 
      53  virtual const std::string &getBody() const;
      54 
      59  virtual const std::string &getHttpVerb() const;
      60 
      65  int getElementId() const;
      66 
      71  void setElementId(int elementId);
      72 
      77  void setUrl(const std::string &url);
      78 
      83  mg_connection *getConnection() const;
      84 
      89  http_message *getHttpMessage() const;
      90 
      95  const std::string &getElementIdString() const;
      96 
      101  void setElementIdString(const std::string &elementIdString);
      102 
      107  int getEvent() const;
      108 
      113  void *getEventData() const;
      114 
      115 
      116 private:
      117  mg_connection *connection;
      118  http_message *httpMessage;
      119  std::string url;
      120  std::string body;
      121  std::string httpVerb;
      122  int elementId;
      123  std::string elementIdString;
      124  int event;
      125  void *eventData;
      126 
      127  void parseMessage(http_message *httpMessage);
      128 };
      129 
      130 
      131 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_REQUEST_H
      int getElementId() const
      Definition: Request.cpp:50
      +
      virtual const std::string & getHttpVerb() const
      Definition: Request.cpp:46
      +
      void * getEventData() const
      Definition: Request.cpp:88
      +
      void setElementId(int elementId)
      Definition: Request.cpp:54
      +
      void setUrl(const std::string &url)
      Definition: Request.cpp:58
      +
      const std::string & getElementIdString() const
      Definition: Request.cpp:70
      Definition: Request.h:13
      -
      virtual void writeResponse(Response *response)
      Definition: Request.cpp:16
      -
      virtual const std::string & getBody() const
      Definition: Request.cpp:39
      -
      virtual const std::string & getUrl() const
      Definition: Request.cpp:35
      -
      Request(mg_connection *connection, http_message *httpMessage)
      Definition: Request.cpp:6
      +
      virtual void writeResponse(Response *response)
      Definition: Request.cpp:19
      +
      mg_connection * getConnection() const
      Definition: Request.cpp:62
      +
      virtual const std::string & getBody() const
      Definition: Request.cpp:42
      +
      int getEvent() const
      Definition: Request.cpp:84
      +
      virtual const std::string & getUrl() const
      Definition: Request.cpp:38
      +
      Request(mg_connection *connection, http_message *httpMessage)
      Definition: Request.cpp:7
      Definition: Response.h:12
      -
      virtual ~Request()
      Definition: Request.cpp:12
      +
      http_message * getHttpMessage() const
      Definition: Request.cpp:66
      +
      virtual ~Request()
      Definition: Request.cpp:15
      +
      void setElementIdString(const std::string &elementIdString)
      Definition: Request.cpp:74
      -Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      5 
      6 #include <vector>
      7 #include "mongoose/mongoose.h"
      8 #include "../controllers/Controller.h"
      9 
      15 class Server {
      17  friend class ServerTest;
      18 
      19 public:
      25  Server(int port = 8080, std::string ip = "127.0.0.1");
      26 
      30  virtual ~Server();
      31 
      35  void start();
      36 
      40  void stop();
      41 
      42 private:
      43  mg_mgr *server;
      44  mg_connection *connection;
      45  int port;
      46  std::string localIp;
      47  bool running;
      48  std::vector<Controller *> controllers;
      49 
      50  void handleRequest(mg_connection *connection, http_message *message);
      51 
      52  friend void event_handler(mg_connection *c, int ev, void *p);
      53 
      54  Response *handleRequest(Request &request);
      55 
      56  void registerController(Controller *controller);
      57 };
      58 
      59 
      60 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      Definition: Server.h:15
      -
      void start()
      Definition: Server.cpp:35
      -
      Server(int port=8080, std::string ip="127.0.0.1")
      Definition: Server.cpp:18
      +Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      5 
      6 #include <vector>
      7 #include "mongoose/mongoose.h"
      8 #include "../controllers/Controller.h"
      9 
      15 class Server {
      17  friend class ServerTest;
      18 
      19 public:
      25  Server(int port = 8080, std::string ip = "127.0.0.1");
      26 
      30  virtual ~Server();
      31 
      35  void start();
      36 
      40  void stop();
      41 
      42 private:
      43  mg_mgr *server;
      44  mg_connection *connection;
      45  int port;
      46  std::string localIp;
      47  bool running;
      48  std::vector<Controller *> controllers;
      49 
      50  void handleRequest(mg_connection *connection, http_message *message);
      51 
      52  //void handleRequest(mg_connection *connection, int event, void *event_data);
      53 
      54  friend void event_handler(mg_connection *new_connection, int event, void *event_data);
      55 
      56  Response *handleRequest(Request &request);
      57 
      58  void registerController(Controller *controller);
      59 
      60  void dispatchRequest(Request &request);
      61 
      62 };
      63 
      64 
      65 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_SERVER_H
      Definition: Server.h:15
      +
      void start()
      Definition: Server.cpp:57
      +
      Server(int port=8080, std::string ip="127.0.0.1")
      Definition: Server.cpp:38
      Definition: Request.h:13
      Definition: Controller.h:14
      friend class ServerTest
      Friend class for testing private methods.
      Definition: Server.h:17
      -
      void stop()
      Definition: Server.cpp:54
      +
      void stop()
      Definition: Server.cpp:76
      Definition: Response.h:12
      -
      virtual ~Server()
      Definition: Server.cpp:26
      +
      virtual ~Server()
      Definition: Server.cpp:48
      -Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      5 
      6 
      7 #include "Controller.h"
      8 #include "../networking/JSONResponse.h"
      9 #include <regex>
      10 
      14 class TracksController : public Controller {
      15 public:
      20 
      24  virtual ~TracksController();
      25 
      32  bool handles(std::string method, std::string url);
      33 
      39  Response *process(Request &request);
      40 
      46  void get(Request &request, JSONResponse &response);
      47 
      53  void post(Request &request, JSONResponse &response);
      54 
      55 private:
      56  std::regex tracksRegex;
      57 };
      58 
      59 
      60 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      virtual ~TracksController()
      Definition: TracksController.cpp:14
      -
      bool handles(std::string method, std::string url)
      Definition: TracksController.cpp:18
      -
      Response * process(Request &request)
      Definition: TracksController.cpp:26
      -
      void post(Request &request, JSONResponse &response)
      +Go to the documentation of this file.
      1 
      2 
      3 #ifndef FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      4 #define FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      5 
      6 
      7 #include "Controller.h"
      8 #include "../networking/JSONResponse.h"
      9 #include <regex>
      10 
      14 class TracksController : public Controller {
      15 public:
      20 
      24  virtual ~TracksController();
      25 
      32  bool handles(std::string method, std::string url);
      33 
      39  Response *process(Request &request);
      40 
      46  void get(Request &request, JSONResponse &response);
      47 
      53  void post(int trackId, const char* filename);
      54 
      59  void setFileName(const char *fileName);
      60 
      61  static struct mg_str upload_fname(struct mg_connection *c, struct mg_str file_name);
      62 
      63 
      64 private:
      65  std::regex tracksRegex;
      66  std::string fileName;
      67 };
      68 
      69 
      70 #endif //FIUBA_TALLER2_TALLERIFY_APP_SERVER_TRACKSCONTROLLER_H
      virtual ~TracksController()
      Definition: TracksController.cpp:22
      +
      bool handles(std::string method, std::string url)
      Definition: TracksController.cpp:26
      +
      Response * process(Request &request)
      Definition: TracksController.cpp:34
      Definition: Request.h:13
      Definition: JSONResponse.h:13
      Definition: Controller.h:14
      -
      TracksController()
      Definition: TracksController.cpp:8
      +
      TracksController()
      Definition: TracksController.cpp:15
      +
      void setFileName(const char *fileName)
      Definition: TracksController.cpp:70
      Definition: Response.h:12
      +
      void post(int trackId, const char *filename)
      Definition: TracksController.cpp:62
      Definition: TracksController.h:14
      diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 84177d1..3aa5f69 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -68,11 +68,13 @@  CJSONResponse  CMongoDao  CPingController - CRequest - CResponse - CServer - CTrack - CTracksController + CPlayController + CRequest + CResponse + CreturnType + CServer + CTrack + CTracksController
      diff --git a/doc/html/class_controller-members.html b/doc/html/class_controller-members.html index 2d2b4cd..d615154 100644 --- a/doc/html/class_controller-members.html +++ b/doc/html/class_controller-members.html @@ -71,8 +71,9 @@ process(Request &request)Controllervirtual routes (defined in Controller)Controllerprotected serverInternalError(std::string message)Controller - urls (defined in Controller)Controllerprotected - ~Controller()Controllervirtual + setElementId(Request &request)Controllerprotected + urls (defined in Controller)Controllerprotected + ~Controller()Controllervirtual
  •  Request (mg_connection *connection, http_message *httpMessage)   + Request (mg_connection *connection, int event, void *eventData) +  virtual ~Request ()   virtual void writeResponse (Response *response) @@ -86,10 +88,22 @@   void setUrl (const std::string &url)   +mg_connection * getConnection () const +  +http_message * getHttpMessage () const +  +const std::string & getElementIdString () const +  +void setElementIdString (const std::string &elementIdString) +  +int getEvent () const +  +void * getEventData () const + 

    Constructor & Destructor Documentation

    -

    ◆ Request()

    +

    ◆ Request() [1/2]

    @@ -121,6 +135,48 @@

    +

    ◆ Request() [2/2]

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Request::Request (mg_connection * connection,
    int event,
    void * eventData 
    )
    +
    +

    Request constructor for multipart requests

    Parameters
    + + + + +
    connection
    event
    eventData
    +
    +
    +
    @@ -174,6 +230,24 @@

    Request body getter

    Returns
    parsed body
    +

    +
    + +

    ◆ getConnection()

    + +
    +
    + + + + + + + +
    mg_connection * Request::getConnection () const
    +
    +

    Get the associated connection

    Returns
    the connection
    +
    @@ -192,6 +266,78 @@

    Get request's element id

    Returns
    element id
    + + +
    +

    ◆ getElementIdString()

    + +
    +
    + + + + + + + +
    const std::string & Request::getElementIdString () const
    +
    +

    Get the element id as string

    Returns
    element id as string
    + +
    +
    + +

    ◆ getEvent()

    + +
    +
    + + + + + + + +
    int Request::getEvent () const
    +
    +

    Event getter

    Returns
    the event code
    + +
    +
    + +

    ◆ getEventData()

    + +
    +
    + + + + + + + +
    void * Request::getEventData () const
    +
    +

    Event data getter

    Returns
    the event data as void*
    + +
    +
    + +

    ◆ getHttpMessage()

    + +
    +
    + + + + + + + +
    http_message * Request::getHttpMessage () const
    +
    +

    Get the original http message

    Returns
    the http message
    +
    @@ -268,6 +414,30 @@

    +

    ◆ setElementIdString()

    + +
    +
    + + + + + + + + +
    void Request::setElementIdString (const std::string & elementIdString)
    +
    +

    Set the elementId as a string

    Parameters
    + + +
    elementIdStringto set
    +
    +
    +
    diff --git a/doc/html/class_server.html b/doc/html/class_server.html index 093ae7f..66e3e80 100644 --- a/doc/html/class_server.html +++ b/doc/html/class_server.html @@ -84,9 +84,9 @@ class ServerTest  Friend class for testing private methods.
      - -void event_handler (mg_connection *c, int ev, void *p) -  + +void event_handler (mg_connection *new_connection, int event, void *event_data) + 

    Constructor & Destructor Documentation

    diff --git a/doc/html/class_tracks_controller-members.html b/doc/html/class_tracks_controller-members.html index cd686c1..146803d 100644 --- a/doc/html/class_tracks_controller-members.html +++ b/doc/html/class_tracks_controller-members.html @@ -69,14 +69,17 @@ Controller()Controller get(Request &request, JSONResponse &response)TracksController handles(std::string method, std::string url)TracksControllervirtual - post(Request &request, JSONResponse &response)TracksController + post(int trackId, const char *filename)TracksController process(Request &request)TracksControllervirtual routes (defined in Controller)Controllerprotected serverInternalError(std::string message)Controller + setElementId(Request &request)Controllerprotected + setFileName(const char *fileName)TracksController TracksController()TracksController - urls (defined in Controller)Controllerprotected - ~Controller()Controllervirtual - ~TracksController()TracksControllervirtual + upload_fname(struct mg_connection *c, struct mg_str file_name) (defined in TracksController)TracksControllerstatic + urls (defined in Controller)Controllerprotected + ~Controller()Controllervirtual + ~TracksController()TracksControllervirtual