--- parser3/src/main/pa_request.C 2001/05/24 09:29:52 1.136 +++ parser3/src/main/pa_request.C 2001/07/18 13:18:00 1.145 @@ -4,9 +4,8 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_request.C,v 1.136 2001/05/24 09:29:52 parser Exp $ */ +static const char *RCSId="$Id: pa_request.C,v 1.145 2001/07/18 13:18:00 parser Exp $"; #include "pa_config_includes.h" @@ -31,6 +30,7 @@ const char *UNHANDLED_EXCEPTION_CONTENT_ /// content type of response when no $MAIN:defaults.content-type defined const char *DEFAULT_CONTENT_TYPE="text/html"; +const char *ORIGINS_CONTENT_TYPE="text/plain"; Methoded *MOP_create(Pool&); @@ -42,6 +42,7 @@ Request::Request(Pool& apool, OP(*MOP_create(apool)), env(apool), form(apool), + math(apool), request(apool, *this), response(apool), cookie(apool), @@ -80,6 +81,8 @@ Request::Request(Pool& apool, /// bases used // form class classes().put(form.get_class()->base()->name(), &form); + // math class + classes().put(math.get_class()->base()->name(), &math); } static void element2ctypes(unsigned char *tables, @@ -206,7 +209,7 @@ void Request::core(const char *root_auto } after=before+1; } - for(int i=ladder.size(); --i>=0; ) { + for(int i=0; ias_vfile(); + bool origins_mode=main_class->get_element(*origins_mode_name)!=0; + + const VFile *body_file=body_vstring_after_post_process->as_vfile( + String::UL_UNSPECIFIED, origins_mode); // extract response body Value *body_value=static_cast( response.fields().get(*body_name)); if(body_value) // there is some $response.body body_file=body_value->as_vfile(); + else if(origins_mode) + response.fields().put(*content_type_name, + NEW VString(*NEW String(pool(), ORIGINS_CONTENT_TYPE))); // OK. write out the result output_result(*body_file, header_only); @@ -343,7 +353,7 @@ void Request::core(const char *root_auto // reset language to default flang=fdefault_lang; if(flang==String::UL_USER_HTML) - flang=String::UL_HTML; // no _ conversions in @exception[params] + flang=String::UL_HTML; // no _ & Co conversions in @exception[params] // reset response response.fields().clear(); @@ -379,7 +389,7 @@ void Request::core(const char *root_auto } #endif frame.store_param(method->name, - origin_value?origin_value:NEW VNothing(pool())); + origin_value?origin_value:NEW VVoid(pool())); // source Value *source_value=0; @@ -390,7 +400,7 @@ void Request::core(const char *root_auto source_value=NEW VString(problem_source_copy); } frame.store_param(method->name, - source_value?source_value:NEW VNothing(pool())); + source_value?source_value:NEW VVoid(pool())); // comment String *comment_value=NEW String(pool(), @@ -405,7 +415,7 @@ void Request::core(const char *root_auto type_value=NEW VString(type_copy.append(*e.type(), flang, true)); } else - type_value=NEW VNothing(pool()); + type_value=NEW VVoid(pool()); frame.store_param(method->name, type_value); // code @@ -415,7 +425,7 @@ void Request::core(const char *root_auto code_value=NEW VString(code_copy.append(*e.code(), flang, true)); } else - code_value=NEW VNothing(pool()); + code_value=NEW VVoid(pool()); frame.store_param(method->name, code_value); // future $response:body= @@ -460,7 +470,7 @@ void Request::core(const char *root_auto body_string=NEW String(pool(), buf); } - const VString body_vstring(*body_string); + VString body_vstring(*body_string); const VFile *body_file=body_vstring.as_vfile(); // ERROR. write it out @@ -505,7 +515,7 @@ VStateless_class *Request::use_buf(const VStateless_class& cclass=COMPILE(source, aclass, name, base_class, file); // locate and execute possible @auto[] static method - execute_method(cclass, *auto_method_name, false /*no result needed*/); + execute_nonvirtual_method(cclass, *auto_method_name, false /*no result needed*/); return &cclass; }