HTTP Get请求URL最大长度
2010-07-25 17:24
239 查看
各浏览器HTTP Get请求URL最大长度并不相同,几类常用浏览器最大长度及超过最大长度后提交情况如下:
IE6.0 :url最大长度2083个字符,超过最大长度后无法提交。
IE7.0 :url最大长度2083个字符,超过最大长度后仍然能提交,但是只能传过去2083个字符。
firefox 3.0.3 :url最大长度7764个字符,超过最大长度后无法提交。
Opera 9.52 :url最大长度7648个字符,超过最大长度后无法提交。
Google Chrome 2.0.168 :url最大长度7713个字符,超过最大长度后无法提交。
注:我的url为http://192.168.6.75:6060/web/urlServlet?m=
微软官方说明见>>
测试代码如下:
urlget.jsp源代码:
URLServlet.java源代码:
IE6.0 :url最大长度2083个字符,超过最大长度后无法提交。
IE7.0 :url最大长度2083个字符,超过最大长度后仍然能提交,但是只能传过去2083个字符。
firefox 3.0.3 :url最大长度7764个字符,超过最大长度后无法提交。
Opera 9.52 :url最大长度7648个字符,超过最大长度后无法提交。
Google Chrome 2.0.168 :url最大长度7713个字符,超过最大长度后无法提交。
注:我的url为http://192.168.6.75:6060/web/urlServlet?m=
微软官方说明见>>
测试代码如下:
urlget.jsp源代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>url get test!</title> </head> <body> <% StringBuffer message = new StringBuffer(); for(int i=1;i<=2041;i++){ if(i%2==0){ message.append("$"); }else{ message.append("@"); } } System.out.println("客户端(message长度):"+message.length()); System.out.println("客户端(message内容):"+message); %> <form action="urlServlet" method="post"> Post提交:<input type="text" value="<%=message%>" name="m"> <input type="submit" value="提交"> </form> Get提交:<a href="urlServlet?m=<%=message %>">urlServlet</a> </body> </html>
URLServlet.java源代码:
package com.ctcmctv.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class URLServlet extends HttpServlet { /** * Constructor of the object. */ public URLServlet() { super(); } public void init() throws ServletException { System.out.println("URLServlet-init"); } public void destroy() { System.out.println("URLServlet-destroy"); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("服务器端-doGet"); request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String message = request.getParameter("m"); PrintWriter out = response.getWriter(); out.println("服务器端-doGet处理结果:"+"<br>"); out.println("message长度:" + message.length()+"<br>"); out.println("message内容:<hr>" + message); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("服务器端-doPost"); request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String message = request.getParameter("m"); PrintWriter out = response.getWriter(); out.println("服务器端-doPost处理结果:"+"<br>"); out.println("message长度:" + message.length()+"<br>"); out.println("message内容:<hr>" + message); } }
相关文章推荐
- HTTP Get请求URL最大长度
- HTTP Get请求URL最大长度
- HTTP Get请求URL最大长度
- GET请求中URL的最大长度限制总结
- 各浏览器HTTP Get请求URL的最大长度
- GET请求中URL的最大长度限制总结
- GET请求中URL的最大长度限制总结
- HTTP Get请求URL最大长度
- GET请求中URL的最大长度限制总结
- url请求最大长度
- url请求最大长度
- GET请求中URL的最大长度限制总结
- GET请求中URL的最大长度限制总结
- HTTP 请求方式: GET和POST的比较当发送数据时,GET 方法向 URL 添加数据;URL 的长度是受限制的(URL 的最大长度是 2048 个字符)。
- HTTP Get请求URL最大长度
- [转载]各浏览器HTTP Get请求URL的最大长度
- 调用webservice时提示对操作的回复消息正文进行反序列化时出错&&Web service 超过了最大请求长度
- Web service 超过了最大请求长度 错误解决
- asp.net MVC 上传文件 System.Web.HttpException- 超过了最大请求长度
- WebService处理大数据量数据出错:运行配置文件中指定的扩展时出现异常。 ---> 超过了最大请求长度。.