Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Server/Basic.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Framework_WebService_Server_Basic_h_
5#define _Stroika_Framework_WebService_Server_Basic_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9#include "Stroika/Frameworks/WebServer/Request.h"
10#include "Stroika/Frameworks/WebServer/RequestHandler.h"
11#include "Stroika/Frameworks/WebServer/Response.h"
12
13#include "Stroika/Frameworks/WebService/Basic.h"
14#include "Stroika/Frameworks/WebService/OpenAPI/Specification.h"
15
16/*
17 */
18
19/*
20 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
21 *
22 * SUPER DUPER ROUGH DRAFT
23 */
24
25namespace Stroika::Frameworks::WebService::Server {
26
27 using namespace Stroika::Foundation;
28
32 using Containers::Set;
34
35 using WebServer::Request;
36 using WebServer::Response;
37
38 /**
39 * \brief check the request method()
40 *
41 * optional<Set<String>> fAllowedMethods; // e.g. GET
42 * throw ClientErrorException if request method not among set of argument methods
43 * \note Set<String> argument - if given - should be case-sensitive comparer
44 */
45 void ExpectedMethod (const Request& request, const Set<String>& methods, const optional<String>& fromInMessage = nullopt);
46 void ExpectedMethod (const Request& request, const Iterable<String>& methods, const optional<String>& fromInMessage = nullopt);
47 void ExpectedMethod (const Request& request, const WebServiceMethodDescription& wsMethodDescription);
48
49 /**
50 */
51 struct DocsOptions {
52 String fH1Text = "Operations"sv;
53 String fIntroductoryText = ""sv; // div section of introductory text about operations
54 Mapping<String, String> fVariables2Substitute;
55 String fCSSSection = kDefaultCSSSection;
56 static const String kDefaultCSSSection;
57 optional<OpenAPI::Specification> fOpenAPISpecification;
58 optional<IO::Network::URI> fOpenAPISpecificationURI;
59 };
60
61 /**
62 */
63 void WriteDocsPage (Response& response, const Sequence<WebServiceMethodDescription>& operations, const DocsOptions& docsOptions = {});
64
65}
66
67/*
68 ********************************************************************************
69 ***************************** Implementation Details ***************************
70 ********************************************************************************
71 */
72#include "Basic.inl"
73
74#endif /*_Stroika_Framework_WebService_Server_Basic_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Definition Sequence.h:187
Set<T> is a container of T, where once an item is added, additionally adds () do nothing.
Definition Set.h:105
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
Definition Iterable.h:237