Html response code

Status Code  

Associated Message  

Meaning  

100

Continue

Continue with partial request. (New in HTTP 1.1)

101

Switching Protocols

Server will comply with Upgrade header and change to different protocol. (New in HTTP 1.1)

200

OK

Everything's fine; document follows for GET and POST requests. This is the default for servlets; if you don't use setStatus, you'll get this.

201

Created

Server created a document; the Location header indicates its URL.

202

Accepted

Request is being acted upon, but processing is not completed.

203

Non-Authoritative Information

Document is being returned normally, but some of the response headers might be incorrect since a document copy is being used. (New in HTTP 1.1)

204

No Content

No new document; browser should continue to display previous document. This is a useful if the user periodically reloads a page and you can determine that the previous page is already up to date. However, this does not work for pages that are automatically reloaded via the Refresh response header or the equivalent header, since returning this status code stops future reloading. JavaScript-based automatic reloading could still work in such a case, though.

205

Reset Content

No new document, but browser should reset document view. Used to force browser to clear CGI form fields. (New in HTTP 1.1)

206

Partial Content

Client sent a partial request with a Range header, and server has fulfilled it. (New in HTTP 1.1)

300

Multiple Choices

Document requested can be found several places; they'll be listed in the returned document. If server has a preferred choice, it should be listed in the Location response header.

301

Moved Permanently

Requested document is elsewhere, and the URL for it is given in the Location response header. Browsers should automatically follow the link to the new URL.

302

Found

Similar to 301, except that the new URL should be interpreted as a temporary replacement, not a permanent one. Note: the message was "Moved Temporarily" in HTTP 1.0, and the constant in HttpServletResponse is SC_MOVED_TEMPORARILY, not SC_FOUND.Very useful header, since browsers automatically follow the link to the new URL. This status code is so useful that there is a special method for it, sendRedirect. Using response.sendRedirect(url) has a couple of advantages over doing response.setStatus(response.SC_MOVED_TEMPORARILY) and response.setHeader("Location", url). First, it is easier. Second, with sendRedirect, the servlet automatically builds a page containing the link (to show to older browsers that don't automatically follow redirects). Finally, sendRedirect can handle relative URLs, automatically translating them to absolute ones.

Note that this status code is sometimes used interchangeably with 301. For example, if you erroneously ask for http://host/~user (missing the trailing slash), some servers will send 301 and others will send 302.

Technically, browsers are only supposed to automatically follow the redirection if the original request was GET. See the 307 header for details.

303

See Other

Like 301/302, except that if the original request was POST, the redirected document (given in the Location header) should be retrieved via GET. (New in HTTP 1.1)

304

Not Modified

Client has a cached document and performed a conditional request (usually by supplying an If-Modified-Since header indicating that it only wants documents newer than a specified date). Server wants to tell client that the old, cached document should still be used.

305

Use Proxy

Requested document should be retrieved via proxy listed in Location header. (New in HTTP 1.1)

307

Temporary Redirect

This is identical to 302 ("Found" or "Temporarily Moved"). It was added to HTTP 1.1 since many browsers erroneously followed the redirection on a 302 response even if the original message was a POST, even though it really ought to have followed the redirection of a POST request only on a 303 response. This response is intended to be unambigously clear: follow redirected GET and POST requests in the case of 303 responses, only follow the redirection for GET requests in the case of 307 responses. Note: for some reason there is no constant in HttpServletResponse corresponding to this status code. (New in HTTP 1.1)

400

Bad Request

Bad syntax in the request.

401

Unauthorized

Client tried to access password-protected page without proper authorization. Response should include a WWW-Authenticate header that the browser would use to pop up a username/password dialog box, which then comes back via the Authorization header.

403

Forbidden

Resource is not available, regardless of authorization. Often the result of bad file or directory permissions on the server.

404

Not Found

No resource could be found at that address. This is the standard "no such page" response. This is such a common and useful response that there is a special method for it in HttpServletResponse: sendError(message). The advantage of sendError over setStatus is that, with sendError, the server automatically generates an error page showing the error message.

405

Method Not Allowed

The request method (GET, POST, HEAD, DELETE, PUT, TRACE, etc.) was not allowed for this particular resource. (New in HTTP 1.1)

406

Not Acceptable

Resource indicated generates a MIME type incompatible with that specified by the client via its Accept header. (New in HTTP 1.1)

407

Proxy Authentication Required

Similar to 401, but proxy server must return a Proxy-Authenticate header. (New in HTTP 1.1)

408

Request Timeout

The client took too long to send the request. (New in HTTP 1.1)

409

Conflict

Usually associated with PUT requests; used for situations such as trying to upload an incorrect version of a file. (New in HTTP 1.1)

410

Gone

Document is gone; no forwarding address known. Differs from 404 in that the document is is known to be permanently gone in this case, not just unavailable for unknown reasons as with 404. (New in HTTP 1.1)

411

Length Required

Server cannot process request unless client sends a Content-Length header. (New in HTTP 1.1)

412

Precondition Failed

Some precondition specified in the request headers was false. (New in HTTP 1.1)

413

Request Entity Too Large

The requested document is bigger than the server wants to handle now. If the server thinks it can handle it later, it should include a Retry-After header. (New in HTTP 1.1)

414

Request URI Too Long

The URI is too long. (New in HTTP 1.1)

415

Unsupported Media Type

Request is in an unknown format. (New in HTTP 1.1)

416

Requested Range Not Satisfiable

Client included an unsatisfiable Range header in request. (New in HTTP 1.1)

417

Expectation Failed

Value in the Expect request header could not be met. (New in HTTP 1.1)

500

Internal Server Error

Generic "server is confused" message. It is often the result of CGI programs or (heaven forbid!) servlets that crash or return improperly formatted headers.

501

Not Implemented

Server doesn't support functionality to fulfill request. Used, for example, when client issues command like PUT that server doesn't support.

502

Bad Gateway

Used by servers that act as proxies or gateways; indicates that initial server got a bad response from the remote server.

503

Service Unavailable

Server cannot respond due to maintenance or overloading. For example, a servlet might return this header if some thread or database connection pool is currently full. Server can supply a Retry-After header.

504

Gateway Timeout

Used by servers that act as proxies or gateways; indicates that initial server didn't get a response from the remote server in time. (New in HTTP 1.1)

505

HTTP Version Not Supported

Server doesn't support version of HTTP indicated in request line. (New in HTTP 1.1)

### JMeter 中 Response Code 500 的原因分析与解决方案 当在 JMeter 测试过程中遇到 HTTP 响应码 500(Internal Server Error),这通常表明服务器端发生了某种错误。以下是可能的原因以及对应的解决方法: #### 可能原因及对应方案 1. **请求参数不正确** 如果发送给服务器的请求参数不符合预期,可能会导致服务器抛出异常并返回状态码 500。可以通过添加断言来验证响应内容是否包含特定的关键字或 HTML 标签[^1]。 解决方法:仔细检查所有请求中的参数设置,确保它们符合 API 文档的要求。 2. **负载过高** 当服务器无法处理过多并发请求时,也可能触发内部错误。这种情况尤其常见于未优化的服务端逻辑或硬件资源不足的情况下。 解决方法:逐步增加线程数以模拟不同级别的负载,并观察性能瓶颈所在位置。如果发现高负载下频繁出现 500 错误,则需联系开发团队调整服务配置或改进代码效率。 3. **脚本编写问题** 对于复杂场景下的功能实现,直接通过传统方式难以完成某些操作;此时可以考虑利用 JSR223 Sampler 编写自定义脚本来替代原有做法。建议优先选用支持编译接口的语言如 Apache Groovy 来提高执行速度和稳定性[^2]。 解决方法:重新审视现有测试计划内的各个组件及其交互流程是否存在潜在漏洞,并尝试改用更高效的技术手段重构相关部分。 4. **系统属性加载失败** 若项目依赖额外定义好的全局变量集合文件(system.properties),而该路径未能成功解析读取的话,同样会造成不可预见的结果——比如默认初始化不当从而引发后续一系列连锁反应最终表现为 500 错误[^3]。 解决方法:确认当前运行环境中确实存在名为 `system.properties` 的配置文档(除非明确禁用了此特性),并且其内部条目均合法有效无冲突之处。 ```python def check_response_code(response): if response.status_code == 500: print("Error: Received a server-side error.") # Add your custom logic here to handle this specific case. ``` 以上是从多个角度探讨了关于为何会在使用 JMeter 进行性能评估期间遭遇 HTTP Status Code 500 的现象及其应对策略。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值