画像の生成に gwan を使用しているため、正しいコンテンツ タイプを設定する必要がありますが、G-WAN 3.12.26 は負荷がかかった後、コンテンツ タイプが text/html の独自のヘッダーを追加し、2 つの http ヘッダーを含むページを返します。
これを再現する方法:
gwan パッケージの setheaders.c サーブレットを使用し、gwan を起動してこのページを開くと、次のhttp://localhost/?setheaders.c
ようになります (正しい応答)。
HTTP/1.1 200 OK
Date: Sat, 29 Dec 2012 20:37:52 GMT
Last-Modified: Sat, 29 Dec 2012 20:37:52 GMT
Content-type: text/html
Content-Length: 371
Connection: close
<!DOCTYPE HTML><html lang="en"><head><title>Setting response headers</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="imgs/style.css" rel="stylesheet" type="text/css"></head><body style="margin:16px;"><h1>Setting response headers</h1><br>This reply was made with custom HTTP headers, look at the servlet source code.<br></body></html>`
今Apacheベンチを実行します:(ab -n 1000 'http://localhost/?setheaders.c'
私のシステムでは1000リクエストで十分でした)。
GWAN を再起動しないで、http://localhost/?setheaders.c
もう一度開くと、次のようになります (応答が正しくない、2 つの http ヘッダー):
HTTP/1.1 200 OK
Server: G-WAN
Date: Sat, 29 Dec 2012 20:43:34 GMT
Last-Modified: Fri, 16 Jan 1970 16:53:33 GMT
ETag: "be86ada7-14b40d-16f"
Vary: Accept-Encoding
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 367
Content-Encoding: gzip
Connection: close
HTTP/1.1 200 OK
Date: Sat, 29 Dec 2012 20:43:34 GMT
Last-Modified: Sat, 29 Dec 2012 20:43:34 GMT
Content-type: text/html
Content-Length: 371
Connection: close
<!DOCTYPE HTML><html lang="en"><head><title>Setting response headers</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="imgs/style.css" rel="stylesheet" type="text/css"></head><body style="margin:16px;"><h1>Setting response headers</h1><br>This reply was made with custom HTTP headers, look at the servlet source code.<br></body></html>
gzip および x-gzip が要求ヘッダーで受け入れ可能なエンコードとして設定されていない場合、GWAN は正しい応答を返します ( Accept-Encoding: gzip, x-gzip
)。
この修正だけでサーブレットを解決することは可能ですか? はいの場合、どのように?