public final class Requests extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getLog(Request request)
Gets log of the specified request.
|
static String |
getRemoteAddr(Request request)
Gets the Internet Protocol (IP) address of the end-client that sent the specified request.
|
static String |
getServerName(Request request)
Gets the server name of the end-client that sent the specified request.
|
static String |
getServerScheme(Request request)
Gets the scheme of the end-client that sent the specified request.
|
static void |
log(Request request,
Level level,
Logger logger)
Logs the specified request with the specified level and logger.
|
public static void log(Request request, Level level, Logger logger)
Logging information of the specified request includes:
request - the specified HTTP requestlevel - the specified logging levellogger - the specified loggerpublic static String getLog(Request request)
request - the specified requestpublic static String getRemoteAddr(Request request)
It will try to get HTTP head "X-forwarded-for" or "X-Real-IP" from the last proxy to get the request first, if not found, try to get
it directly by Request.getRemoteAddr().
request - the specified requestpublic static String getServerScheme(Request request)
request - the specified reuqestCopyright © 2009–2019 B3log. All rights reserved.