Changeset 23233
- Timestamp:
- 2010-10-27T14:41:49+13:00 (13 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src/oaiservr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp
r22739 r23233 293 293 this->repositoryIdVersion = cfgline[0]; 294 294 } 295 else if (key == "baseURL") { 296 this->baseURL = cfgline[0]; 297 } 298 else if (key == "baseLibraryURL") { 299 this->baseLibraryURL = cfgline[0]; 300 } 301 else if (key == "baseDocRoot") { 302 this->baseDocRoot = cfgline[0]; 303 } 295 else if (key == "baseServerURL") { 296 this->baseServerURL = cfgline[0]; 297 } 298 else if (key == "oaiserverPath") { 299 this->oaiserverPath = cfgline[0]; 300 } 301 else if (key == "libraryPath") { 302 this->libraryPath = cfgline[0]; 303 } 304 else if (key == "docRootPath") { 305 this->docRootPath = cfgline[0]; 306 } 307 304 308 else if (key == "oaiversion") { 305 309 this->oaiVersion = cfgline[0]; 306 310 } 307 311 312 } 313 314 text_t oaiconfig::generateBaseServerURL() { 315 char *server_name = getenv("SERVER_NAME"); 316 char *server_port = getenv("SERVER_PORT"); 317 text_t url = "http://"; 318 url.append(server_name); 319 url.append(":"); 320 url.append(server_port); 321 return url; 308 322 } 309 323 … … 354 368 text_t oaiconfig::getBaseURL() 355 369 { 356 return this->baseURL; 370 if (this->baseServerURL.empty()) { 371 this->baseServerURL = generateBaseServerURL(); 372 } 373 return this->baseServerURL + this->oaiserverPath; 357 374 } 358 375 text_t oaiconfig::getBaseLibraryURL() 359 376 { 360 return this->baseLibraryURL; 377 if (this->baseServerURL.empty()) { 378 this->baseServerURL = generateBaseServerURL(); 379 } 380 return this->baseServerURL + this->libraryPath; 361 381 } 362 382 text_t oaiconfig::getBaseDocRoot() 363 383 { 364 return this->baseDocRoot; 384 if (this->baseServerURL.empty()) { 385 this->baseServerURL = generateBaseServerURL(); 386 } 387 return this->baseServerURL + this->docRootPath; 388 } 389 390 text_t oaiconfig::getRelativeBaseDocRoot() 391 { 392 return this->docRootPath; 365 393 } 366 394 text_t oaiconfig::getRepositoryName() -
main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.h
r22739 r23233 61 61 text_t getBaseLibraryURL(); 62 62 text_t getBaseDocRoot(); 63 text_t getRelativeBaseDocRoot(); 63 64 text_t getRepositoryName(); 64 65 text_t getRepositoryId(); … … 67 68 private: 68 69 bool configureCollection(const text_t &gsdlhome, const text_t &collection); 69 70 text_t generateBaseServerURL(); 70 71 text_t repositoryName; // human readable name 71 72 text_t repositoryId; // unique (among oai servers) domain name or id for the repository 72 73 text_t repositoryIdVersion; // 1.1 or 2.0 for identifier scheme 73 text_t baseURL; // URL of oaiserver.cgi 74 text_t baseLibraryURL; // URL of library.cgi (used for urls to greenstone documents ) 75 text_t baseDocRoot; // Base URL for gsdl directory (used for urls to source documents ) 74 text_t baseServerURL; // URL of web server 75 text_t oaiserverPath; // relative path for oaiserver 76 text_t libraryPath; //relative path for library.cgi (used for urls to greenstone documents ) 77 text_t docRootPath; // relative path for gsdl directory (used for urls to source documents and oai xsl ) 76 78 text_t oaiVersion; // The version of OAI running 77 79 int resumptionSize; // The number of items to produce before spitting out a resumptionToken
Note:
See TracChangeset
for help on using the changeset viewer.