|
|
| version 1.200, 2002/04/16 14:41:39 | version 1.205, 2002/04/29 05:59:33 |
|---|---|
| Line 163 gettimeofday(&mt[0],NULL); | Line 163 gettimeofday(&mt[0],NULL); |
| charsets->for_each(load_charset); | charsets->for_each(load_charset); |
| else | else |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &vcharsets->name(), | 0, |
| "must be hash"); | "$" CHARSETS_NAME " must be hash"); |
| } | } |
| } | } |
| // configure root options | // configure root options |
| Line 257 gettimeofday(&mt[2],NULL); | Line 257 gettimeofday(&mt[2],NULL); |
| if(const Method *method=junction->method) { | if(const Method *method=junction->method) { |
| // preparing to pass parameters to | // preparing to pass parameters to |
| // @postprocess[data] | // @postprocess[data] |
| VMethodFrame frame(pool(), value->name(), *junction); | VMethodFrame frame(pool(), method->name, *junction); |
| frame.set_self(*main_class); | frame.set_self(*main_class); |
| frame.store_param(method->name, | frame.store_param(&body_vstring_before_post_process); |
| &body_vstring_before_post_process); | |
| body_vstring_after_post_process= | body_vstring_after_post_process= |
| NEW VString(execute_method(frame, *method)); | NEW VString(execute_method(frame, *method)); |
| } | } |
| bool origins_mode=main_class->get_element(*origins_mode_name)!=0; | bool lorigins_mode=origins_mode(); |
| const VFile *body_file=body_vstring_after_post_process->as_vfile( | const VFile *body_file=body_vstring_after_post_process->as_vfile( |
| String::UL_UNSPECIFIED, origins_mode); | String::UL_UNSPECIFIED, lorigins_mode); |
| // extract response body | // extract response body |
| Value *body_value=static_cast<Value *>( | Value *body_value=static_cast<Value *>( |
| response.fields().get(*body_name)); | response.fields().get(*body_name)); |
| if(body_value) // there is some $response.body | if(body_value) // there is some $response.body |
| body_file=body_value->as_vfile(); | body_file=body_value->as_vfile(); |
| else if(origins_mode) | else if(lorigins_mode) |
| response.fields().put(*content_type_name, | response.fields().put(*content_type_name, |
| NEW VString(*NEW String(pool(), ORIGINS_CONTENT_TYPE))); | NEW VString(*NEW String(pool(), ORIGINS_CONTENT_TYPE))); |
| Line 310 t[9]-t[3] | Line 309 t[9]-t[3] |
| // we're returning not result, but error explanation | // we're returning not result, but error explanation |
| try { | try { |
| // log the beast | // log the beast |
| const String *problem_source=e.problem_source(); | if(const String *problem_source=e.problem_source()) |
| if(problem_source && problem_source->size()) | |
| SAPI::log(pool(), | SAPI::log(pool(), |
| "%s: " | "%s: " |
| #ifndef NO_STRING_ORIGIN | #ifndef NO_STRING_ORIGIN |
| Line 353 t[9]-t[3] | Line 351 t[9]-t[3] |
| if(const Method *method=junction->method) { | if(const Method *method=junction->method) { |
| // preparing to pass parameters to | // preparing to pass parameters to |
| // @unhandled_exception[exception;stack] | // @unhandled_exception[exception;stack] |
| VMethodFrame frame(pool(), value->name(), *junction); | VMethodFrame frame(pool(), method->name, *junction); |
| frame.set_self(*main_class); | frame.set_self(*main_class); |
| // $exception | // $exception |
| frame.store_param(method->name, &exception2vhash(pool(), e)); | frame.store_param(&exception2vhash(pool(), e)); |
| // $stack[^table::set{name origin}] | // $stack[^table::set{name origin}] |
| Array& stack_trace_columns=*NEW Array(pool()); | Array& stack_trace_columns=*NEW Array(pool()); |
| stack_trace_columns+=NEW String(pool(), "name"); | stack_trace_columns+=NEW String(pool(), "name"); |
| Line 381 t[9]-t[3] | Line 379 t[9]-t[3] |
| #endif | #endif |
| stack_trace+=&row; | stack_trace+=&row; |
| } | } |
| frame.store_param(method->name, | frame.store_param(NEW VTable(pool(), &stack_trace)); |
| NEW VTable(pool(), &stack_trace)); | |
| // future $response:body= | // future $response:body= |
| // execute ^exception[origin;source;comment;type;code;stack] | // execute ^exception[origin;source;comment;type;code;stack] |
| Line 396 t[9]-t[3] | Line 393 t[9]-t[3] |
| // make up result: $origin $source $comment $type $code | // make up result: $origin $source $comment $type $code |
| char *buf=(char *)malloc(MAX_STRING); | char *buf=(char *)malloc(MAX_STRING); |
| size_t printed=0; | size_t printed=0; |
| const String *problem_source=e.problem_source(); | if(const String *problem_source=e.problem_source()) { |
| if(problem_source) { | |
| #ifndef NO_STRING_ORIGIN | #ifndef NO_STRING_ORIGIN |
| const Origin& origin=problem_source->origin(); | const Origin& origin=problem_source->origin(); |
| if(origin.file) | if(origin.file) |
| Line 461 VStateless_class *Request::use_file(cons | Line 457 VStateless_class *Request::use_file(cons |
| } | } |
| } else | } else |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &element->name(), | 0, |
| "must be string or table"); | "$" CLASS_PATH_NAME " must be string or table"); |
| if(!file_spec) | if(!file_spec) |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &file_name, | &file_name, |
| Line 471 VStateless_class *Request::use_file(cons | Line 467 VStateless_class *Request::use_file(cons |
| if(!file_spec) | if(!file_spec) |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &file_name, | &file_name, |
| "usage failed - no " MAIN_CLASS_NAME ":" CLASS_PATH_NAME " were specified"); | "usage failed - no $" MAIN_CLASS_NAME ":" CLASS_PATH_NAME " were specified"); |
| } | } |
| char *source=file_read_text(pool(), *file_spec, fail_on_read_problem); | char *source=file_read_text(pool(), *file_spec, fail_on_read_problem); |