MythTV
master
libs
libmythbase
http
mythhttprewrite.cpp
Go to the documentation of this file.
1
// MythTV
2
#include "
mythdirs.h
"
3
#include "
mythlogging.h
"
4
#include "
http/mythhttprewrite.h
"
5
#include "
http/mythhttpdata.h
"
6
#include "
http/mythhttpfile.h
"
7
#include "
http/mythhttprequest.h
"
8
#include "
http/mythhttpresponse.h
"
9
10
22
HTTPResponse
MythHTTPRewrite::RewriteFile
(
const
HTTPRequest2
&
Request
,
const
QString &File)
23
{
24
auto
result =
static_cast<
HTTPResponse
>
(
nullptr
);
25
if
(!
Request
)
26
return
result;
27
28
LOG
(VB_HTTP, LOG_INFO, QString(
"Rewriting request to new file '%1'"
).arg(File));
29
if
(!File.isEmpty())
30
{
31
Request
->m_fileName = File;
32
result =
MythHTTPFile::ProcessFile
(
Request
);
33
}
34
return
result;
35
36
}
37
50
HTTPResponse
MythHTTPRewrite::RewriteToSPA
(
const
HTTPRequest2
&
Request
,
const
QString &File)
51
{
52
auto
result =
static_cast<
HTTPResponse
>
(
nullptr
);
53
if
(!
Request
)
54
return
result;
55
56
LOG
(VB_HTTP, LOG_INFO, QString(
"Rewriting request to web app '%1'"
).arg(File));
57
if
(!File.isEmpty()
58
&& (
Request
->m_path.isEmpty() ||
Request
->m_path ==
"/"
||
Request
->m_path ==
"/settings/"
))
59
{
60
Request
->m_fileName = File;
61
Request
->m_status =
HTTPOK
;
62
Request
->m_path =
"/"
;
63
result =
MythHTTPFile::ProcessFile
(
Request
);
64
}
65
return
result;
66
67
}
HTTPOK
@ HTTPOK
Definition:
mythhttptypes.h:106
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition:
mythlogging.h:39
mythdirs.h
mythhttpdata.h
mythhttpfile.h
MythHTTPRewrite::RewriteFile
static HTTPResponse RewriteFile(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for files to a context specific file.
Definition:
mythhttprewrite.cpp:22
MythHTTPFile::ProcessFile
static HTTPResponse ProcessFile(const HTTPRequest2 &Request)
Definition:
mythhttpfile.cpp:35
mythlogging.h
mythhttprewrite.h
mythhttpresponse.h
HTTPResponse
std::shared_ptr< MythHTTPResponse > HTTPResponse
Definition:
mythhttptypes.h:39
hardwareprofile.distros.mythtv_data.request.Request
def Request(url=None)
Definition:
distros/mythtv_data/request.py:64
HTTPRequest2
std::shared_ptr< MythHTTPRequest > HTTPRequest2
Definition:
mythhttptypes.h:38
mythhttprequest.h
MythHTTPRewrite::RewriteToSPA
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
Definition:
mythhttprewrite.cpp:50
Generated on Fri Mar 31 2023 03:24:35 for MythTV by
1.8.17