Coverage Report

Created: 2026-02-14 07:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wt/src/Wt/WServer.h
Line
Count
Source
1
// This may look like C code, but it's really -*- C++ -*-
2
/*
3
 * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4
 *
5
 * See the LICENSE file for terms of use.
6
 */
7
#ifndef WSERVER_H_
8
#define WSERVER_H_
9
10
#include <Wt/WApplication.h>
11
#include <Wt/WException.h>
12
#include <Wt/WLogger.h>
13
14
#include <chrono>
15
16
namespace http {
17
  namespace server {
18
    class Server;
19
  }
20
}
21
namespace Wt {
22
23
class Configuration;
24
class WebController;
25
class WIOService;
26
#ifndef WT_TARGET_JAVA
27
class WWebSocketResource;
28
#endif // WT_TARGET_JAVA
29
/*! \class WServer Wt/WServer.h Wt/WServer.h
30
 *  \brief A class encapsulating a web application server.
31
 *
32
 * This server class represents an instance of an application server.
33
 *
34
 * It offers support for multiple application entry points and control
35
 * over starting and stopping the server. This may be used as an
36
 * alternative to using WRun() when you wish to support multiple
37
 * application entry points, or for integrating a %Wt (stand-alone
38
 * httpd) server application into an existing application, with control
39
 * over starting and stopping the server as appropriate.
40
 *
41
 * As an example usage, consider the implementation of WRun(), which
42
 * starts the server until a Ctrl-C is pressed or a termination signal
43
 * has been received, or a restart is indicated using SIGHUP or a changed
44
 * binary (argv[0]):
45
 *
46
 * \code
47
int WRun(int argc, char *argv[], ApplicationCreator createApplication)
48
{
49
  try {
50
    // use argv[0] as the application name to match a suitable entry
51
    // in the Wt configuration file, and use the default configuration
52
    // file (which defaults to /etc/wt/wt_config.xml unless the environment
53
    // variable WT_CONFIG_XML is set)
54
    WServer server(argv[0]);
55
56
    // WTHTTP_CONFIGURATION is e.g. "/etc/wt/wthttpd"
57
    server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
58
59
    // add a single entry point, at the default location (as determined
60
    // by the server configuration's deploy-path)
61
    server.addEntryPoint(Wt::EntryPointType::Application, createApplication);
62
    if (server.start()) {
63
      int sig = WServer::waitForShutdown();
64
65
      std::cerr << "Shutdown (signal = " << sig << ")" << std::endl;
66
      server.stop();
67
68
      if (sig == SIGHUP)
69
        WServer::restart(argc, argv, environ);
70
    }
71
  } catch (WServer::Exception& e) {
72
    std::cerr << e.what() << "\n";
73
    return 1;
74
  } catch (std::exception& e) {
75
    std::cerr << "exception: " << e.what() << "\n";
76
    return 1;
77
  }
78
}
79
 * \endcode
80
 */
81
#ifdef WT_WIN32
82
class WServer
83
#else // WT_WIN32
84
class WTCONNECTOR_API WServer
85
#endif // WT_WIN32
86
{
87
public:
88
  typedef std::function<std::string (std::size_t max_length, int purpose)>
89
    SslPasswordCallback;
90
91
  /*! \class Exception
92
   *  \brief Server %Exception class.
93
   */
94
  class WT_API Exception : public WException
95
  {
96
  public:
97
    Exception(const std::string& what);
98
  };
99
100
#ifndef WT_TARGET_JAVA
101
  /*! \class SessionInfo
102
   *
103
   * \brief Contains the information for one session.
104
   */
105
  struct WT_API SessionInfo
106
  {
107
    int64_t     processId; //!< The process id of the process the session is running in.
108
    std::string sessionId; //!< The session id.
109
  };
110
#endif // WT_TARGET_JAVA
111
112
  /*! \brief Creates a new server instance.
113
   *
114
   * The \p wtApplicationPath is used to match specific
115
   * application-settings in the %Wt configuration file. If no
116
   * specific match could be found, the general settings are used
117
   * (corresponding to the '*' selector).
118
   *
119
   * The %Wt application configuration is read from the
120
   * \p wtConfigurationFile. If empty, this defaults to the value
121
   * configured at build time.
122
   *
123
   * For more information on configuring %Wt applications, see \ref
124
   * configuration_sec "Configuration".
125
   *
126
   * \throws Exception : indicates a configuration problem.
127
   *
128
   * \sa setServerConfiguration()
129
   */
130
  WTCONNECTOR_API
131
    WServer(const std::string& wtApplicationPath = std::string(),
132
            const std::string& wtConfigurationFile = std::string());
133
134
  WServer(const WServer &) = delete;
135
136
  /*! \brief Creates a new server instance and configures it.
137
   *
138
   * This is equivalent to:
139
   * \code
140
    WServer server(argv[0]);
141
    server.setServerConfiguration(argc, argv, wtConfigurationFile);
142
    \endcode
143
   *
144
   * \throws Exception : indicates a configuration problem.
145
   *
146
   * \sa WServer(const std::string&, const std::string&)
147
   * \sa setServerConfiguration()
148
   */
149
  WTCONNECTOR_API
150
    WServer(int argc, char *argv[], const std::string& wtConfigurationFile = std::string());
151
152
  /*! \brief Creates a new server instance and configures it.
153
   *
154
   * This is equivalent to:
155
   * \code
156
    WServer server(applicationPath);
157
    server.setServerConfiguration(applicationPath, args, wtConfigurationFile);
158
    \endcode
159
   *
160
   * This version of the WServer constructor takes a std::string
161
   * for the application path, and a vector of arguments (not including
162
   * argv[0], the application path) instead of argc and argv,
163
   * for better convenience when arguments are not provided via
164
   * the command line.
165
   *
166
   * \throws Exception : indicates a configuration problem.
167
   *
168
   * \sa WServer(const std::string&, const std::string&)
169
   * \sa setServerConfiguration()
170
   */
171
  WTCONNECTOR_API
172
    WServer(const std::string &applicationPath,
173
            const std::vector<std::string> &args,
174
            const std::string& wtConfigurationFile = std::string());
175
176
  /*! \brief Destructor.
177
   *
178
   * If the server was still running, it is stopped first by calling
179
   * stop(). It is probably safer to call stop() first yourself, since
180
   * this allows exceptions to be caught.
181
   *
182
   * \sa isRunning(), stop()
183
   */
184
  WTCONNECTOR_API virtual ~WServer();
185
186
#ifndef WT_TARGET_JAVA
187
  /*! \brief Sets the I/O service.
188
   *
189
   * The server will use an I/O service for scheduling functions into a
190
   * thread-pool, and to implement asynchronous networking, whose call-back
191
   * funtions are scheduled in the same thread pool.
192
   *
193
   * By default, a server will create its own I/O service, but you may
194
   * configure it to reuse another I/O service.
195
   */
196
  WT_API void setIOService(WIOService& ioService);
197
198
  /*! \brief Returns the I/O service.
199
   *
200
   * \sa setIOService()
201
   */
202
  WT_API WIOService& ioService();
203
#endif
204
205
  /*! \brief Returns the server instance.
206
   *
207
   * Returns the single server instance. This may be useful when using
208
   * WRun(), which does not provide direct access to the instantiated
209
   * server, but still you want to use functions like
210
   * post().
211
   *
212
   * \note When instantiating multiple servers, this will simply return the
213
   *       last instance. You probably want to avoid this function then.
214
   */
215
1.10k
  static WServer *instance() { return instance_; }
216
217
#ifndef WT_TARGET_JAVA
218
  /*! \brief Configures the HTTP(S) server or FastCGI process.
219
   *
220
   * Configures the HTTP(S) server using command-line arguments, a
221
   * configuration file, or both. The valid options are described in
222
   * \ref config_wthttpd "Built-in httpd configuration".
223
   *
224
   * The applications themselves are configured using the configuration
225
   * file passed to the constructor.
226
   *
227
   * The server configuration must be set before any other
228
   * functionality can be used.
229
   *
230
   * In case of FastCGI deployment, the \p serverConfigurationFile
231
   * argument is ignored, and depending on the command-line arguments,
232
   * this process may become a FastCGI protocol relay process which
233
   * never returning from this call but directs the FastCGI stream to
234
   * the correct session, rather than a Wt application server.
235
   *
236
   * \throws Exception : indicates a configuration problem.
237
   */
238
  WTCONNECTOR_API
239
    void setServerConfiguration(int argc, char *argv[],
240
                                const std::string& serverConfigurationFile
241
                                = std::string());
242
243
  /*! \brief Configures the HTTP(S) server or FastCGI process.
244
   *
245
   * Configures the HTTP(S) server using command-line arguments, a
246
   * configuration file, or both. The valid options are described in
247
   * \ref config_wthttpd "Built-in httpd configuration".
248
   *
249
   * The applications themselves are configured using the configuration
250
   * file passed to the constructor.
251
   *
252
   * The server configuration must be set before any other
253
   * functionality can be used.
254
   *
255
   * In case of FastCGI deployment, the \p serverConfigurationFile
256
   * argument is ignored, and depending on the command-line arguments,
257
   * this process may become a FastCGI protocol relay process which
258
   * never returning from this call but directs the FastCGI stream to
259
   * the correct session, rather than a Wt application server.
260
   *
261
   * This version of setServerConfiguration() takes a std::string
262
   * for the application path, and a vector of arguments (not including
263
   * argv[0], the application path) instead of argc and argv,
264
   * for better convenience when arguments are not provided via
265
   * the command line.
266
   *
267
   * \throws Exception : indicates a configuration problem.
268
   */
269
  WTCONNECTOR_API
270
    void setServerConfiguration(const std::string &applicationPath,
271
                                const std::vector<std::string> &args,
272
                                const std::string &serverConfigurationFile = std::string());
273
274
  /*! \brief Binds an entry-point to a callback function to create
275
   *         a new application.
276
   *
277
   * The \p path is the local URL at which the application is
278
   * deployed: when a user visits this URL, the callback will be
279
   * called to create a new application.
280
   *
281
   * If the \p path does not start with a slash ('/'), the deployment path
282
   * will be prepended. The deployment path defaults to '/' but can be overridden
283
   * in the wthttp connector with the --deploy-path option (see also \ref
284
   * config_wthttpd "Built-in httpd configuration"). This implies that when
285
   * the \p path is empty (the default), it is set to the deployment path.
286
   *
287
   * The optional \p favicon is a URL path (which should not
288
   * contain the host part!) to a favicon, which is the icon displayed
289
   * in the browser for your application. Alternatively, you may
290
   * specify a favicon using the "favicon" property in the
291
   * configuration file (see also \ref config_general).
292
   *
293
   * \sa removeEntryPoint()
294
   */
295
  WT_API void addEntryPoint(EntryPointType type, ApplicationCreator callback,
296
                            const std::string& path = std::string(),
297
                            const std::string& favicon = std::string());
298
#endif
299
300
  /*! \brief Binds a resource to a fixed path.
301
   *
302
   * Resources may either be private to a single session or
303
   * public. Use this method to add a public resource with a fixed
304
   * path.
305
   *
306
   * \throw Exception if an entrypoint was already registered at the given path
307
   *
308
   * \sa removeEntryPoint()
309
   */
310
  WT_API void addResource(const std::shared_ptr<WResource>& resource, const std::string& path);
311
312
#ifndef WT_TARGET_JAVA
313
  /*! \brief Binds a WebSocket resource to a fixed \p path.
314
   *
315
   * This will add a public resource that is deployed on a fixed \p path.
316
   * The resource will be accessible to any client that is able to access
317
   * the server on the \p path.
318
   *
319
   * \throw Exception if an entrypoint was already registered at the given path
320
   *
321
   * \sa removeEntryPoint()
322
   */
323
  WT_API void addResource(const std::shared_ptr<WWebSocketResource>& resource, const std::string& path);
324
#endif // WT_TARGET_JAVA
325
326
  /*! \brief Binds a resource to a fixed path.
327
   *
328
   * Resources may either be private to a single session or
329
   * public. Use this method to add a public resource with a fixed
330
   * path.
331
   *
332
   * \note Ownership of the resource is external to %WServer. The resource first needs
333
   *       to be \link removeEntryPoint() removed\endlink (while the server is
334
   *       \link stop() stopped\endlink) before being destroyed, or has to outlive the %WServer.
335
   *
336
   * \throw Exception if an entrypoint was already registered at the given path
337
   *
338
   * \sa removeEntryPoint()
339
   *
340
   * \deprecated Use addResource(const std::shared_ptr<WResource>&, const std::string&) instead.
341
   */
342
  WT_DEPRECATED("Use addResource(const std::shared_ptr<WResource>&, const std::string&) instead")
343
  WT_API void addResource(WResource *resource, const std::string& path);
344
345
  /*! \brief Removes an entry point.
346
   *
347
   * Use this method to remove an entry point or static resource.
348
   *
349
   * \note If the entry point is a resource, the resource will not be deleted
350
   *
351
   * \sa addEntryPoint(), addResource()
352
   */
353
  WT_API void removeEntryPoint(const std::string& path);
354
355
  /*! \brief Unbinds a resource from a fixed path.
356
   *
357
   * Use this method to remove a static resource.
358
   *
359
   * \note The resource object itself will not be destructed, and can
360
           still be in use in other threads. However, any new requests
361
           to its path will no longer be handled by the removed
362
           resource.
363
   *
364
   * \sa addResource()
365
   */
366
  WT_API void removeResource(const WResource* resource);
367
368
#ifndef WT_TARGET_JAVA
369
  /*! \brief Starts the server in the background.
370
   *
371
   * Returns whether the server could be successfully started.
372
   *
373
   * \throws Exception : indicates a problem starting the server.
374
   *
375
   * \sa isRunning(), stop()
376
   */
377
  WTCONNECTOR_API bool start();
378
379
  /*! \brief Stops the server.
380
   *
381
   * All active application sessions are terminated cleanly, and the
382
   * HTTP(S) server is shut down.
383
   *
384
   * \note This will also stop the underlying ioService(), and will block
385
   *       until all pending tasks have completed.
386
   *
387
   * \throw Exception : indicates a problem while stopping the server.
388
   *
389
   * \sa isRunning(), start()
390
   */
391
  WTCONNECTOR_API void stop();
392
393
  /*! \brief Returns whether the server is running.
394
   *
395
   * \sa start(), stop()
396
   */
397
  WTCONNECTOR_API bool isRunning() const;
398
399
  /*! \brief Starts the server, waits for shutdown, then stops the server.
400
   *
401
   * This is equivalent to:
402
   * \code
403
    if (start()) {
404
      WServer::waitForShutdown();
405
      stop();
406
    }
407
    \endcode
408
   * \sa start()
409
   * \sa stop()
410
   * \sa waitForShutdown()
411
   */
412
  WTCONNECTOR_API void run();
413
414
  /*! \brief Resumes the server.
415
   *
416
   * This closes and reopens the listen socket(s) for accepting new
417
   * TCP and/or SSL connections. This may be needed when the OS (like
418
   * IPhoneOS) has closed the sockets while suspending the
419
   * application.
420
   */
421
  WTCONNECTOR_API void resume();
422
423
  /*! \brief Waits for a shutdown signal.
424
   *
425
   * This static method blocks the current thread, waiting for a
426
   * shutdown signal. The implementation and details are platform
427
   * dependent, but this is usually Ctrl-C (SIGINT) or SIGKILL.
428
   *
429
   * This method is convenient if you want to customize how the server
430
   * is started (by instantiating a WServer object yourself, instead
431
   * of using Wt::WRun()), but still want to use %Wt as a standalone
432
   * server that cleanly terminates on interruption.
433
   *
434
   * This will also catch SIGHUP, to reread the configuration file.
435
   */
436
  WT_API static int waitForShutdown();
437
438
  /*! \brief A utility method to restart.
439
   *
440
   * This will result the application with the new image (argv[0]), effectively
441
   * loading a newly deployed version. <i>(Experimental, UNIX only)</i>
442
   */
443
  WT_API static void restart(int argc, char **argv, char **envp);
444
445
  /*! \brief A utility method to restart.
446
   *
447
   * This will result the application with the new image (applicationPath), effectively
448
   * loading a newly deployed version. <i>(Experimental, UNIX only)</i>
449
   *
450
   * This version of restart() takes a std::string
451
   * for the application path, and a vector of arguments (not including
452
   * argv[0], the application path) instead of argc and argv,
453
   * for better convenience when arguments are not provided via
454
   * the command line.
455
   */
456
  WT_API static void restart(const std::string &applicationPath,
457
                             const std::vector<std::string> &args);
458
459
  /*! \brief Returns the server HTTP port number.
460
   *
461
   * Returns -1 if the port is not known (i.e. because the connector is
462
   * not aware of how the http server is configured).
463
   *
464
   * \note If the server listens on multiple ports, only the first
465
   *       port is returned.
466
   */
467
  WTCONNECTOR_API int httpPort() const;
468
469
  WT_API void setAppRoot(const std::string& path);
470
471
  /*! \brief Returns the approot special property
472
   *
473
   * \sa WApplication::appRoot()
474
   */
475
  WT_API std::string appRoot() const;
476
477
  /*! \brief Returns the docroot (if using wthttp)
478
   *
479
   * If you're using wthttp, this returns the location passed to the
480
   * --docroot argument, just like WApplication::docRoot(). This allows access
481
   * to this parameter outside of the context of a WApplication.
482
   *
483
   * If you're using any other connector, this returns the empty string.
484
   */
485
   WTCONNECTOR_API std::string docRoot() const;
486
487
  /*! \brief Posts a function to a session.
488
   *
489
   * This is a thread-safe method to post a particular event
490
   * (implemented as a function object) to be run within the context
491
   * of a session, identified by its WApplication::sessionId(). The
492
   * method will safely handle the case where the session is being
493
   * terminated, and the session lock will be taken to execute the
494
   * function in the context of the session (with
495
   * WApplication::instance() pointing to the correct application),
496
   * just as with a request initiated by the browser. You will
497
   * typically also want to push the changes to the client using
498
   * server-initiated updates (WApplication::triggerUpdate()).
499
   *
500
   * The method returns immediately, and the function will be run
501
   * within the thread-pool that handles incoming web requests. In
502
   * this way, it avoids dead-lock scenarios.
503
   *
504
   * If a \p fallbackFunction is specified then in case the session
505
   * is dead, it is called instead.
506
   *
507
   * This provides a good alternative to grabbing the update lock of
508
   * an application to directly push changes to a session out of its
509
   * event loop.
510
   *
511
   * Note that if you post an event to a method of a widget (or other
512
   * object), it may still be that the targeted object has been
513
   * deleted, if the life-time of that object is not the same as the
514
   * life-time of the application. It may be useful to protect
515
   * yourself from this by using WApplication::bind().
516
   */
517
  WT_API void post(const std::string& sessionId,
518
                   const std::function<void ()>& function,
519
                   const std::function<void ()>& fallBackFunction
520
                     = std::function<void ()>());
521
522
  /*! \brief Posts a function to all currently active sessions.
523
   *
524
   * \sa post()
525
   */
526
  WT_API void postAll(const std::function<void ()>& function);
527
528
  /*! \brief Schedules a function to be executed in a session.
529
   *
530
   * The \p function will run in the session specified by \p sessionId,
531
   * after \p duration. If the session does not exist anymore,
532
   * \p fallBackFunction will be executed.
533
   *
534
   * \sa post()
535
   */
536
  WT_API void schedule(std::chrono::steady_clock::duration duration,
537
                       const std::string& sessionId,
538
                       const std::function<void ()>& function,
539
                       const std::function<void ()>& fallBackFunction
540
                         = std::function<void ()>());
541
542
  /*! \brief Change input method for server certificate passwords (http backend)
543
   *
544
   * The private server identity key may be protected by a password. If you
545
   * want to control how the password is retrieved, set a password handler
546
   * by calling this function. If no password handler is set, the OpenSSL
547
   * default handler will be used, which asks to enter the password on stdio.
548
   *
549
   * This function must be called before calling start().
550
   *
551
   * The max_length parameter is informational and indicates that the
552
   * underlying implementation will truncate the password to this length.
553
   */
554
  WTCONNECTOR_API void setSslPasswordCallback(const SslPasswordCallback& cb);
555
556
#endif // WT_TARGET_JAVA
557
558
#ifndef WT_TARGET_JAVA
559
  /*! \brief Reads a configuration property.
560
   *
561
   * As properties are unique to an executable location, they are defined
562
   * from the moment that setServerConfiguration() is invoked. Use this
563
   * method to access configuration properties outside of an active
564
   * session, e.g. from within the main() function.
565
   *
566
   * \sa WApplication::readConfigurationProperty()
567
568
   */
569
  WT_API bool readConfigurationProperty(const std::string& name,
570
                                        std::string& value) const;
571
572
#else
573
  /*! \brief Reads a configuration property.
574
   *
575
   * Tries to read a configured value for the property \p name. If no
576
   * value was configured, the default \p value is returned.
577
   *
578
   * \sa WApplication::readConfigurationProperty()
579
   */
580
  std::string *readConfigurationProperty(const std::string& name,
581
                                         const std::string& value);
582
#endif // WT_TARGET_JAVA
583
584
  /*! \brief Sets the resource object that provides localized strings.
585
   *
586
   * This is used only for WString::tr() used from within static
587
   * resources.
588
   *
589
   * The default value is 0.
590
   */
591
  WT_API void setLocalizedStrings(const std::shared_ptr<WLocalizedStrings>&
592
                                  stringResolver);
593
594
  /*! \brief Sets the resource object that provides localized strings.
595
   *
596
   * \sa setLocalizedStrings()
597
   */
598
  WT_API std::shared_ptr<WLocalizedStrings> localizedStrings() const;
599
600
#ifndef WT_TARGET_JAVA
601
602
  /*! \brief Retrieve information on all sessions.
603
   *
604
   * This is only implemented for the wthttp connector.
605
   *
606
   * If the dedicated process session policy is used, only the original
607
   * process has access to the full list of sessions. Public resources
608
   * (those registered with addResource()) run in the original process,
609
   * so they can access this list.
610
   */
611
  WTCONNECTOR_API std::vector<SessionInfo> sessions() const;
612
613
  void updateProcessSessionId(const std::string& sessionId);
614
615
  /*! \brief Returns the logger instance.
616
   *
617
   * This is the logger class used in WApplication::log() and
618
   * Wt::log() functions.
619
   */
620
  WT_API WLogger& logger();
621
622
  /*! \brief Sets a custom logger to redirect all logging to.
623
   *
624
   * Instead of using the server's default logger, this will send
625
   * all logging to some custom WLogSink.
626
   */
627
  WT_API void setCustomLogger(const WLogSink &customLogger);
628
629
  const WLogSink * customLogger() const;
630
631
  /*! \brief Adds an entry to the log.
632
   *
633
   * \sa Wt::log(), WApplication::log()
634
   */
635
  WT_API WLogEntry log(const std::string& type) const;
636
637
  WT_API void initLogger(const std::string& logFile,
638
                         const std::string& logConfig);
639
640
  /*! \brief Reflects whether the current process is a dedicated session process
641
   *
642
   * \note This will only be accurate after the WServer has been configured, either
643
   *       through setServerConfiguration() or one of the constructors that immediately
644
   *       configures the server.
645
   */
646
  WT_API bool dedicatedSessionProcess() const;
647
#endif // WT_TARGET_JAVA
648
649
  WT_API bool expireSessions();
650
651
  WT_API Configuration& configuration();
652
653
  WT_API WebController *controller();
654
655
#ifndef WT_TARGET_JAVA
656
  WT_API void scheduleStop();
657
#endif // WT_TARGET_JAVA
658
659
#ifdef WT_WIN32
660
  WT_API static void terminate();
661
#endif // WT_WIN32
662
663
#ifdef WT_TARGET_JAVA
664
  std::string getContextPath();
665
  int servletMajorVersion();
666
#endif
667
668
private:
669
  WebController *webController_;
670
671
#ifndef WT_TARGET_JAVA
672
  std::vector<std::shared_ptr<WWebSocketResource>> webSocketResources_;
673
674
  WLogger logger_;
675
  const WLogSink * customLogger_;
676
#endif // WT_TARGET_JAVA
677
678
  std::string application_, configurationFile_, appRoot_, description_;
679
  Configuration *configuration_;
680
  std::shared_ptr<WLocalizedStrings> localizedStrings_;
681
682
  bool ownsIOService_;
683
  WIOService *ioService_;
684
685
  bool dedicatedProcessEnabled_;
686
687
  struct Impl;
688
  Impl *impl_;
689
690
  WT_API void setConfiguration(const std::string& file,
691
                               const std::string& application);
692
693
  WT_API void setConfiguration(const std::string& file);
694
0
  const std::string& configurationFile() const {
695
0
    return configurationFile_;
696
0
  }
697
698
  WT_API void init(const std::string& wtApplicationPath,
699
                   const std::string& configurationFile);
700
  WT_API void destroy();
701
  WT_API void setCatchSignals(bool catchSignals);
702
  WT_API std::string prependDefaultPath(const std::string& path);
703
704
705
  WT_API static WServer *instance_;
706
  std::function<std::string (std::size_t max_length, int purpose)> sslPasswordCallback_;
707
#ifndef WT_TARGET_JAVA
708
  std::function<void ()> stopCallback_;
709
  std::function<void (const std::string& sessionId)> updateProcessSessionIdCallback_;
710
#endif // WT_TARGET_JAVA
711
};
712
713
}
714
#endif // WSERVER_H_