I never seem to remember the exact syntax for getting CGI variables in JSP. So, I put what I found here so I would not have to look again.
SERVER_NAME request.getServerName();
SERVER_SOFTWARE request.getServletContext().getServerInfo();
SERVER_PROTOCOL request.getProtocol();
SERVER_PORT request.getServerPort();
REQUEST_METHOD request.getMethod();
PATH_INFO request.getPathInfo();
PATH_TRANSLATED request.getPathTranslated();
SCRIPT_NAME request.getServletPath();
DOCUMENT_ROOT request.getRealPath("/");
QUERY_STRING request.getQueryString();
REMOTE_HOST request.getRemoteHost();
REMOTE_ADDR request.getRemoteAddr();
AUTH_TYPE request.getAuthType();
REMOTE_USER request.getRemoteUser();
CONTENT_TYPE request.getContentType();
CONTENT_LENGTH request.getContentLength();
HTTP_ACCEPT request.getHeader("Accept");
HTTP_USER_AGENT request.getHeader("User-Agent");
HTTP_REFERER request.getHeader("Referer");
No comments:
Post a Comment