CppCMS
http_content_filter.h
1 //
3 // Copyright (C) 2008-2015 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_HTTP_CONTENT_FILTER_H
9 #define CPPCMS_HTTP_CONTENT_FILTER_H
10 
11 #include <cppcms/defs.h>
12 #include <cppcms/cppcms_error.h>
13 #include <booster/hold_ptr.h>
14 #include <booster/noncopyable.h>
15 #include <string>
16 
17 namespace cppcms {
18 
19 namespace impl {
20  struct cached_settings;
21 }
22 
23 namespace http {
24  class file;
25  class context;
26 
31  class CPPCMS_API abort_upload : public cppcms_error {
32  public:
38  abort_upload(int status_code);
39  virtual ~abort_upload() throw();
43  int code() const;
44  private:
45  int code_;
46  };
47 
52  class CPPCMS_API content_limits : public booster::noncopyable {
53  friend class request;
54  public:
56  content_limits(impl::cached_settings const &);
58  ~content_limits();
60 
67  long long content_length_limit() const;
74  void content_length_limit(long long size);
75 
82  long long multipart_form_data_limit() const;
89  void multipart_form_data_limit(long long size);
90 
94  size_t file_in_memory_limit() const;
98  void file_in_memory_limit(size_t size);
99 
103  std::string uploads_path() const;
107  void uploads_path(std::string const &path);
108 
109  private:
110 
111  long long content_length_limit_;
112  size_t file_in_memory_limit_;
113  long long multipart_form_data_limit_;
114  std::string uploads_path_;
115 
116  struct _data;
118  };
119 
127  class CPPCMS_API basic_content_filter {
129  void operator=(basic_content_filter const &);
130  public:
131  basic_content_filter();
132  virtual ~basic_content_filter();
133 
139  virtual void on_end_of_content();
144  virtual void on_error();
145  private:
146  struct _data;
148  };
149 
157  class CPPCMS_API raw_content_filter : public basic_content_filter {
158  public:
166  virtual void on_data_chunk(void const *data,size_t data_size) = 0;
167 
169  virtual ~raw_content_filter();
170  private:
171  struct _raw_data;
173  };
174 
182  class CPPCMS_API multipart_filter : public basic_content_filter {
183  public:
185  virtual ~multipart_filter();
195  virtual void on_new_file(http::file &input_file);
205  virtual void on_upload_progress(http::file &input_file);
215  virtual void on_data_ready(http::file &input_file);
216 
217  private:
218  struct _mp_data;
220  };
221 
222 } // http
223 } // cppcms
224 
225 #endif
Definition: http_content_filter.h:31
Exception thrown by CppCMS framework.
Definition: cppcms_error.h:22
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
Definition: http_content_filter.h:127
Definition: http_content_filter.h:157
This class holds a uploaded file, it is generally fetched via widgets::file or via http::request::fil...
Definition: http_file.h:38
Definition: http_content_filter.h:182
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
Definition: http_content_filter.h:52
This class represents all information related to the HTTP/CGI request.
Definition: http_request.h:37