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 ==
"/"
59
||
Request
->m_path ==
"/dashboard/"
||
Request
->m_path ==
"/setupwizard/"
60
||
Request
->m_path ==
"/MythFE/"
))
61
{
62
Request
->m_fileName = File;
63
Request
->m_status =
HTTPOK
;
64
Request
->m_path =
"/"
;
65
result =
MythHTTPFile::ProcessFile
(
Request
);
66
}
67
return
result;
68
69
}
HTTPOK
@ HTTPOK
Definition:
mythhttptypes.h:107
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:62
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 Thu Apr 25 2024 03:18:52 for MythTV by
1.8.17