欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

java和jsp中的request使用示例

程序员文章站 2024-02-21 23:54:52
复制代码 代码如下://== java request 详细说明== system.out.println("rotocol: " + request.getpr...

复制代码 代码如下:

//== java request 详细说明==
 system.out.println("rotocol: " + request.getprotocol());
 system.out.println("scheme: " + request.getscheme());
 system.out.println("server name: " + request.getservername() );
 system.out.println("server port: " + request.getserverport());
 system.out.println("rotocol: " + request.getprotocol());
 system.out.println("server info: " + getservletconfig().getservletcontext().getserverinfo());
 system.out.println("remote addr: " + request.getremoteaddr());
 system.out.println("remote host: " + request.getremotehost());
 system.out.println("character encoding: " + request.getcharacterencoding());
 system.out.println("content length: " + request.getcontentlength());
 system.out.println("content type: "+ request.getcontenttype());
 system.out.println("auth type: " + request.getauthtype());
 system.out.println("http method: " + request.getmethod());
 system.out.println("ath info: " + request.getpathinfo());
 system.out.println("ath trans: " + request.getpathtranslated());
 system.out.println("query string: " + request.getquerystring());
 system.out.println("remote user: " + request.getremoteuser());
 system.out.println("session id: " + request.getrequestedsessionid());
 system.out.println("request uri: " + request.getrequesturi());
 system.out.println("servlet path: " + request.getservletpath());
 system.out.println("accept: " + request.getheader("accept"));
 system.out.println("host: " + request.getheader("host"));
 system.out.println("referer : " + request.getheader("referer"));
 system.out.println("accept-language : " + request.getheader("accept-language"));
 system.out.println("accept-encoding : " + request.getheader("accept-encoding"));
 system.out.println("user-agent : " + request.getheader("user-agent"));
 system.out.println("connection : " + request.getheader("connection"));
 system.out.println("cookie : " + request.getheader("cookie"));
 system.out.println("created : " + session.getcreationtime());
 system.out.println("lastaccessed : " + session.getlastaccessedtime());

// ==jsp request 详细说明==

 out.println("protocol: " + request.getprotocol());
 out.println("scheme: " + request.getscheme());
 out.println("server name: " + request.getservername() );
 out.println("server port: " + request.getserverport());
 out.println("protocol: " + request.getprotocol());
 out.println("server info: " + getservletconfig().getservletcontext().getserverinfo());
 out.println("remote addr: " + request.getremoteaddr());
 out.println("remote host: " + request.getremotehost());
 out.println("character encoding: " + request.getcharacterencoding());
 out.println("content length: " + request.getcontentlength());
 out.println("content type: "+ request.getcontenttype());
 out.println("auth type: " + request.getauthtype());
 out.println("http method: " + request.getmethod());
 out.println("path info: " + request.getpathinfo());
 out.println("path trans: " + request.getpathtranslated());
 out.println("query string: " + request.getquerystring());
 out.println("remote user: " + request.getremoteuser());
 out.println("session id: " + request.getrequestedsessionid());
 out.println("request uri: " + request.getrequesturi());
 out.println("servlet path: " + request.getservletpath());
 out.println("accept: " + request.getheader("accept"));
 out.println("host: " + request.getheader("host"));
 out.println("referer : " + request.getheader("referer"));
 out.println("accept-language : " + request.getheader("accept-language"));
 out.println("accept-encoding : " + request.getheader("accept-encoding"));
 out.println("user-agent : " + request.getheader("user-agent"));
 out.println("connection : " + request.getheader("connection"));
 out.println("cookie : " + request.getheader("cookie"));
 out.println("created : " + session.getcreationtime());
 out.println("lastaccessed : " + session.getlastaccessedtime());