java获取客服端信息(系统,浏览器等)
String agent = requestgetHeader("user-agent");
Systemoutprintln(agent);
StringTokenizer st = new StringTokenizer(agent,";");
stnextToken();
String userbrowser = stnextToken();
Systemoutprintln(userbrowser);
String useros = stnextToken();
Systemoutprintln(useros);
Systemoutprintln(SystemgetProperty("osname")); //win2003竟然是win xp?
Systemoutprintln(SystemgetProperty("osversion"));
Systemoutprintln(SystemgetProperty("osarch"));
Systemoutprintln(requestgetHeader("user-agent")); //返回客户端浏览器的版本号、类型
Systemoutprintln(requestgetMethod()); //:获得客户端向服务器端传送数据的方法有get、post、put等类型
Systemoutprintln(requestgetRequestURI()); //:获得发出请求字符串的客户端地址
Systemoutprintln(requestgetServletPath()); //:获得客户端所请求的脚本文件的文件路径
Systemoutprintln(requestgetServerName()); //:获得服务器的名字
Systemoutprintln(requestgetServerPort()); //:获得服务器的端口号
Systemoutprintln(requestgetRemoteAddr()); //:获得客户端的ip地址
Systemoutprintln(requestgetRemoteHost()); //:获得客户端电脑的名字,若失败,则返回客户端电脑的ip地址
Systemoutprintln(requestgetProtocol()); //:
Systemoutprintln(requestgetHeaderNames()); //:返回所有request header的名字,结果集是一个enumeration(枚举)类的实例
Systemoutprintln("Protocol: " + requestgetProtocol());
Systemoutprintln("Scheme: " + requestgetScheme());
Systemoutprintln("Server Name: " + requestgetServerName() );
Systemoutprintln("Server Port: " + requestgetServerPort());
Systemoutprintln("Protocol: " + requestgetProtocol());
Systemoutprintln("Server Info: " + getServletConfig()getServletContext()getServerInfo());
Systemoutprintln("Remote Addr: " + requestgetRemoteAddr());
Systemoutprintln("Remote Host: " + requestgetRemoteHost());
Systemoutprintln("Character Encoding: " + requestgetCharacterEncoding());
Systemoutprintln("Content Length: " + requestgetContentLength());
Systemoutprintln("Content Type: "+ requestgetContentType());
Systemoutprintln("Auth Type: " + requestgetAuthType());
Systemoutprintln(">
以上就是关于java怎么获取客户端的请求信息全部的内容,包括:java怎么获取客户端的请求信息、线下来的客户app端录客路径是A、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)