2.10.5 DDの定義例
(1) HTTPレスポンスのボディサイズで圧縮条件を指定する場合
HTTPレスポンスのボディサイズで圧縮条件を指定する場合の定義例を示します。
<web-app>
:
<!-- The filter for Response Compression Filter -->
<filter>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<filter-class>com.hitachi.software.was.web.ResponseCompressionFilter</filter-class>
<init-param>
<param-name>url-mapping</param-name>
<param-value>
/*=rule1;
</param-value>
</init-param>
<init-param>
<param-name>rule1</param-name>
<param-value>
*:1000;
</param-value>
</init-param>
</filter>
:
<!-- The filter mappings for Response Compression Filter -->
<filter-mapping>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
:
</web-app> |
定義例では,URLパターンが/*のアクセスに対するHTTPレスポンスで,ボディサイズが1,000バイトを超えるものを圧縮します。
(2) URLパターンで圧縮条件を指定する場合
URLパターンで圧縮条件を指定する場合の定義例を示します。
<web-app>
:
<!-- The filter for Response Compression Filter -->
<filter>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<filter-class>com.hitachi.software.was.web.ResponseCompressionFilter</filter-class>
<init-param>
<param-name>url-mapping</param-name>
<param-value>
/app/dir/*=rule1;
*.html=rule1;
</param-value>
</init-param>
<init-param>
<param-name>rule1</param-name>
<param-value>
*:100;
</param-value>
</init-param>
</filter>
:
<!-- The filter mappings for Response Compression Filter -->
<filter-mapping>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<url-pattern>/app/*</url-pattern>
</filter-mapping>
:
</web-app> |
定義例では,URLパターンが/app/*のアクセスに対するHTTPレスポンスで次の条件を満たすものを圧縮します。
- HTTPリクエストのURLパターンが/app/dir/*で,ボディサイズが100バイトを超えるHTTPレスポンス
- HTTPリクエストのURLパターンが*.htmlで,ボディサイズが100バイトを超えるHTTPレスポンス
(3) HTTPレスポンスのMedia-Typeで圧縮条件を指定する場合
HTTPレスポンスのMedia-Typeで圧縮条件を指定する場合の定義例を示します。
<web-app>
:
<!-- The filter for Response Compression Filter -->
<filter>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<filter-class>com.hitachi.software.was.web.ResponseCompressionFilter</filter-class>
<init-param>
<param-name>url-mapping</param-name>
<param-value>
/*=rule1;
</param-value>
</init-param>
<init-param>
<param-name>rule1</param-name>
<param-value>
text/html:500;
application/pdf:1000;
</param-value>
</init-param>
</filter>
:
<!-- The filter mappings for Response Compression Filter -->
<filter-mapping>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
:
</web-app> |
定義例はURLパターンが/*のアクセスに対するHTTPレスポンスで次の条件を満たすものを圧縮します。
- Media-Typeがtext/htmlでボディサイズが500バイトを超えるHTTPレスポンス
- Media-Typeがapplication/pdfでボディサイズが1,000バイトを超えるHTTPレスポンス
(4) 圧縮条件を組み合わせて指定する場合
次に示す例のように,圧縮条件を組み合わせて定義することもできます。
<web-app>
:
<!-- The filter for Response Compression Filter -->
<filter>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<filter-class>com.hitachi.software.was.web.ResponseCompressionFilter</filter-class>
<init-param>
<param-name>url-mapping</param-name>
<param-value>
/app/dir1/*=rule1;
/app/dir2/*=rule2;
*.html=rule3;
</param-value>
</init-param>
<init-param>
<param-name>rule1</param-name>
<param-value>
*:500;
application/pdf:1000;
</param-value>
</init-param>
<init-param>
<param-name>rule2</param-name>
<param-value>
application/pdf:2000;
</param-value>
</init-param>
<init-param>
<param-name>rule3</param-name>
<param-value>
*:100;
</param-value>
</init-param>
</filter>
:
<!-- The filter mappings for Response Compression Filter -->
<filter-mapping>
<filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
<url-pattern>/app/*</url-pattern>
</filter-mapping>
:
</web-app> |
定義例では,URLパターンが/app/*のアクセスに対するHTTPレスポンスで次の条件を満たすものを圧縮します。
- HTTPリクエストのURLパターンが/app/dir1/*でMedia-Typeがapplication/pdf以外,ボディサイズが500バイトを超えるHTTPレスポンス
- HTTPリクエストのURLパターンが/app/dir1/*でMedia-Typeがapplication/pdf,ボディサイズが1,000バイトを超えるHTTPレスポンス
- HTTPリクエストのURLパターンが/app/dir2/*でMedia-Typeがapplication/pdf,ボディサイズが2,000バイトを超えるHTTPレスポンス
- HTTPリクエストのURLパターンが*.htmlでボディサイズが100バイトを超えるHTTPレスポンス