Commit Graph

19 Commits

Author SHA1 Message Date
Tomasz Sowa f7b5ac0dc8 change the way how winix answer is created
Now we can return ezc content and models serialized in the same json structure,
Xml and Csv are not implemented yet.
Ezc frames are returned in 'ezc_frames' field.
Main ezc stream is returned in 'main_stream' field.
Frame url parameter can take more than one frame (names separated by commas).
Honor Accept http header (AcceptParser).

Samples:
--------
http://domain.tld/dir/controller
returns html answer from the main ezc stream

http://domain.tld/dir/controller/container:raw
returns html answer from the main ezc stream (the same as above)

http://domain.tld/dir/controller/frame:abc
returns "abc" frame as html

http://domain.tld/dir/controller/container:json
returns all serialized models to json and no ezc streams

http://domain.tld/dir/controller/container:xml
returns all serialized models to xml and no ezc streams (not implemented yet)

http://domain.tld/dir/controller/container:json/frame:abc,xyz
returns all serialized models to json and two frames in 'ezc_frames' object

http://domain.tld/dir/controller/container:json/all_frames
returns all serialized models to json and all frames in 'ezc_frames' object

http://domain.tld/dir/controller/container:json/main_stream
returns all serialized models and the main ezc stream in 'main_stream' field

http://domain.tld/dir/controller/container:json/main_stream/all_frames
returns all serialized models to json, all frames and the main stream
2022-02-01 18:44:23 +01:00
Tomasz Sowa d5ebb7ca12 changed the way how the request's answer is created,
now winix can return json, xml, csv from out_main_stream or from frames and json from models

removed from Request:
  bool send_bin_stream
  bool return_json
  bool return_info_only
  pt::Space info
  bool page_generated
  bool out_main_stream_use_html_filter
  bool out_streams_use_html_filter

added to Request:
  enum AnswerSource
  enum AnswerContainer
  AnswerSource answer_source
  AnswerContainer answer_container
  bool use_ezc_engine
  std::wstring frame
  bool send_all_frames
  bool use_html_filter

added to Config:
 // the name of the url parameter for returning all frames, e.g. https://domain.tld/mydir/myfunction/allframes
 // default: allframes
 std::wstring request_all_frames_parameter;

 // the name of the root element when serializing request answer to xml
 // default: winix
 std::wstring xml_root;

algorithm (the whole algorithm is described in core/request.h):
at the beginning of a request winix sets
   answer_source to models
   answer_container to text
   use_ezc_engine to true

next answer_container and use_ezc_engine can be changed in the following way:

1. winix will look for 'Accept' http header and depending on the header winix will set:
   (not implemented yet)

             Accept | answer_container | use_ezc_engine
	     ------------------------------------|-----------------
	     application/json | json             | false
	      application/xml | xml              | false
	              text/csv | csv              | false

2. next answer_container is set depending on 'container' url parameter
       container | answer_container
 ---------------------------------------------------------
     not present | don't change the value
            text | text
            json | json
             xml | xml
             csv | csv

use_ezc_engine is set depending on 'answer' url parameter:
          answer | use_ezc_engine
 ---------------------------------
     not present | don't change the value
            html | true
            data | false

if 'answer' is html then we take into account two more parameters:
 frame: frame_name (empty default) - if set then winix returns this specific frame
 allframes: (if present then winix returns all frames)
2021-10-13 01:27:14 +02:00
Tomasz Sowa 26ed7b80be changed values for send_file_mode config parameter:
0 - winix will read the content of the file and send it back to the webserver
  1 - winix will use send_file_header header with a full path to the file
  2 - winix will use send_file_header header with a relative path to the file
2021-09-17 03:35:56 +02:00
Tomasz Sowa c5c02d7f44 HtmlTextStream has now pt::Stream as a based class and uses pt::WTextStream as a buffer 2021-07-16 18:17:57 +02:00
Tomasz Sowa df3f04a951 added to misc: timespec_to_stream_with_unit() for printing times either is seconds or miliseconds 2021-06-30 16:30:11 +02:00
Tomasz Sowa 2f1cdcf379 added printing info how much time winix spent in the ezc engine
added to Request:
timespec timespec_req_stop;
timespec timespec_req_diff;
timespec timespec_ezc_engine_start;
timespec timespec_ezc_engine_stop;
2021-06-24 15:33:44 +02:00
Tomasz Sowa 2c5062ba22 UrlEncode() methods from core/misc.h are now thread safe 2021-06-23 17:04:07 +02:00
Tomasz Sowa 79eda7abb0 - added to FunctionBase: bool register_default_models (default true)
if true then winix will add default models for ezc templates such as "request", "item", etc.
- some methods from templates/item.cpp moved to Item
2021-06-20 18:04:50 +02:00
Tomasz Sowa 8bb585d97d updated to the new pikotools api: changed utf8 functions PascalCase to snake_case 2021-05-21 00:41:27 +02:00
Tomasz Sowa e48a28a5c8 namespace PT renamed to pt 2021-05-20 20:59:12 +02:00
Tomasz Sowa f1af7e2eeb updated to the current pikotools api from branch api2021 2021-05-11 22:20:46 +02:00
Tomasz Sowa afbe82e9f4 changed the way how prefixes are added to urls
instead at the end we adding a prefix before an extension, e.g: filename_(2).jpg
2021-02-25 00:12:45 +01:00
Tomasz Sowa 32e93a04c5 Item class has been moved to a new directory 'models', a new class has been added: ItemContent
and same fields from Item were moved to ItemContent

Item
- id
- parent_id
- type (file, dir, symlink)
- url
- subject
- template (html template)
- sort_index
- content_id

ItemContent
- id
- ref -> references (renamed)
- user_id
- modification_user_id
- group_id
- privileges
- date_creation
- date_modification
- guest_name
- link_to
- link_redirect
- file_path
- file_fs
- file_type
- file_size
- has_thumb -> file_has_thumb (renamed)
- hash -> file_hash (renamed)
- hash_type -> file_hash_type (renamed)
- content -> content_raw (renamed)
- content_type -> content_raw_type (renamed)
- content_parsed
- content_parsed_type
- meta
- ameta -> meta_admin (renamed)
- modify_index (removed)

WIP: #4
2021-02-24 01:19:47 +01:00
Tomasz Sowa 919c2f62f5 using PT::IsSubString* methods from pikotools
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1138 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-01 00:46:44 +00:00
Tomasz Sowa 8f6004d444 removed some IsSubstring* functions
(they are in Pikotools in text/convert.h now)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1135 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-29 23:51:11 +00:00
Tomasz Sowa 436a198c36 changed: using PT::ToLower instead of ToSmall
using PT::ToUpper instead of ToCapital
         using PT::EqualNoCase instead of EqualNoCase
         



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1112 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-25 17:22:12 +00:00
Tomasz Sowa 3f29cdc01e changed: config parameters: log_check_proxy_ip_header -> check_proxy_ip_header and log_proxy_ip_header -> proxy_ip_header
added: Request::ip_str (std::wstring) (string of the client's IP address)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1105 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-01 11:22:55 +00:00
Tomasz Sowa ca14b1a427 added: Request::header_in (Space) http input headers (without cookies)
added: config parameter: log_env_http_variables (bool) (for logging http headers)
added: support for DELETE http method, added method FunctionBase::MakeDelete()
changed: winix version incremented to 0.6.6




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1100 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-25 19:48:47 +00:00
Tomasz Sowa ed5adb3f23 moved winix directories to winixd subdirectory
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1027 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-17 08:24:59 +00:00