source: trunk/gsdl/src/recpt/receptionist.h@ 146

Last change on this file since 146 was 146, checked in by rjmcnab, 25 years ago

Developed the idea of an "action" and having them define the cgi arguments
which they need and how those cgi arguments function.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/**********************************************************************
2 *
3 * receptionist.h -- a web interface for the gsdl
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: receptionist.h 146 1999-02-04 10:00:57Z rjmcnab $
9 *
10 *********************************************************************/
11
12
13#ifndef RECEPTIONIST_H
14#define RECEPTIONIST_H
15
16#include "gsdlconf.h"
17#include "text_t.h"
18#include "cgiargs.h"
19
20#ifndef MACROPRECEDENCE
21#define MACROPRECEDENCE "style,collection,queryversion,version,language"
22#endif
23
24
25class receptionist {
26public:
27 receptionist () {}
28 virtual ~receptionist() {}
29
30 // this version of set_gsdlhome should be used if the receptionist
31 // is being run for multiple collections ("general" mode).
32 void set_gsdlhome (const text_t &thegsdlhome);
33
34 // this version of set_gsdlhome should be used if the receptionist
35 // is being run for a single collection ("collection specific" mode).
36 void set_gsdlhome (const text_t &thegsdlhome, const text_t &thecollection);
37
38 // sets the http address of the images directory. This is used to
39 // speed up the access to the images which are a part of the general
40 // interface. If this is not set the interface will have to get the
41 // images via gwcgi which will be a lot slower (especially if the
42 // browser does not cache the images).
43 void set_httpimg (const text_t &thehttpimg);
44
45 // sets the http address of the gateway cgi program (ie. the program
46 // that contains this receptionist).
47 void set_gwcgi (const text_t &thegwcgi);
48
49 // digest should be called after setgsdhome has been called.
50 // It returns true on success and false on failure. If false is
51 // returned getpage should not be called (without producing
52 // meaningless output), instead an error page should be
53 // produced by the calling code.
54 bool digest (ostream &logout);
55
56 // There are two ways to produce a page. You can either call parse_cgi_args,
57 // get_cgihead_info, and produce_content or you can just call produce_cgi_page
58 // which will be satisfactory in most cases. You might want to call
59 // parse_cgi_args, get_cgihead_info, and produce_content when you want to
60 // call get_compressed_arg or interface directly with a web server for which
61 // the standard header is inappropriate.
62
63 // produce_cgi_page will call parse_cgi_args, get_cgihead_info and
64 // produce_content in the appropriate way to output a cgi header and
65 // the page content (if needed).
66 void produce_cgi_page (const text_t &argstr, ostream &contentout,
67 ostream &logout);
68
69 // parse_cgi_args parses cgi arguments into an argument class.
70 // This function should be called for each page request.
71 void parse_cgi_args (const text_t &argstr, cgiargsclass &args, ostream &logout);
72
73 // response_t is used to inform the calling code what type of
74 // cgi header it should produce
75 // eventually this should reside in cgiutils.h
76 enum response_t {location, content};
77
78 // get_cgihead_info determines the cgi header information for
79 // a set of cgi arguments. If response contains location then
80 // response_data contains the redirect address. If reponse
81 // contains content then reponse_data contains the content-type.
82 // Note that images can now be produced by the receptionist.
83 void get_cgihead_info (cgiargsclass &args, response_t &response,
84 text_t &response_data, ostream &logout);
85
86 // produce the page content
87 void produce_content (cgiargsclass &args, ostream &contentout,
88 ostream &logout);
89
90 // returns the compressed argument ("e") corresponding to the argument
91 // list. This can be used to save preferences between sessions.
92 text_t get_compressed_arg (const cgiargsclass &args);
93
94protected:
95 text_t gsdlhome;
96 text_t collectdir; // will equal gsdlhome in 'general' mode
97 text_t collection; // will equal "" in 'general' mode
98 text_t httpimg;
99 text_t gwcgi;
100
101
102
103};
104
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.