快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐app官网_机器人论坛



package coreservlets;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.util.*;

/** Creates a table showing the current value of each

* of the standard CGI variables.

*

* Taken from Core Servlets and JavaServer Pages

* from Prentice Hall and Sun Microsystems Press,

* http://www.coreservlets.com/.

* © 2000 Marty Hall; may be freely used or adapted.

*/

public class ShowCGIVariables extends HttpServlet {

public void doGet(HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String[][] variables =

{ { "AUTH_TYPE", request.getAuthType() },

{ "CONTENT_LENGTH",

String.valueOf(request.getContentLength()) },

{ "CONTENT_TYPE", request.getContentType() },

{ "DOCUMENT_ROOT",

getServletContext().getRealPath("/") },

{ "PATH_INFO", request.和记娱乐app官网getPathInfo() },

{ "PATH_TRANSLATED", request.getPathTranslated() },

{ "QUERY_STRING", request.getQueryString() },

{ "REMOTE_ADDR", request.getRem和记娱乐app官网oteAddr() },

{ "REMOTE_HOST", request.getRemoteHost() },

{ "REMOTE_USER", request.getRemoteUser() },

{ "REQUEST_METHOD", request.getMethod() },

{ "SCRIPT_NAME", request.getServletPath() },

{ "SERVER_NAME", request.getServerName() },

{ "SERVER_PORT",

String.valueOf(request.getServerPort()) },

{ "SERVER_PROTOCOL", request.getProtocol() },

{ "SERVER_SOFTWARE",

getServletContext().getServerInfo() }

};

String title = "Ser和记娱乐app官网vlet Example: Showing CGI Variables";

out.println(ServletUtilities.headWithTitle(title) +

"

" +

"" + title + "

" +

"

" +

"

" +

"CGI Variable NameValue");

for(int i=0; iNot specified";

out.println("

" + varName + "

" + varValue);

}

out.println("");

}

/** POST and GET requests handl和记娱乐app官网ed identically. */

public void doPost(HttpServletRequest request,

HttpServletResponse response)

throw和记娱乐app官网s ServletException, IOException {

doGet(request, response);

}

}

您可能还会对下面的文章感兴趣: