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

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

Got it outputing something.

  • 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 145 1999-02-04 01:17:28Z 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 // init 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 init (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 enum response_t {location, content};
76
77 // get_cgihead_info determines the cgi header information for
78 // a set of cgi arguments. If response contains location then
79 // response_data contains the redirect address. If reponse
80 // contains content then reponse_data contains the content-type.
81 // Note that images can now be produced by the receptionist.
82 void get_cgihead_info (const cgiargsclass &args, response_t &response,
83 text_t &response_data, ostream &logout);
84
85 // produce the page content
86 void produce_content (const cgiargsclass &args, ostream &contentout,
87 ostream &logout);
88
89 // returns the compressed argument ("e") corresponding to the argument
90 // list. This can be used to save preferences between sessions.
91 text_t get_compressed_arg (const cgiargsclass &args);
92
93protected:
94 text_t gsdlhome;
95 text_t collectdir; // will equal gsdlhome in 'general' mode
96 text_t collection; // will equal "" in 'general' mode
97 text_t httpimg;
98 text_t gwcgi;
99
100
101
102};
103
104
105
106#endif
Note: See TracBrowser for help on using the repository browser.