About adding the java filter program

Asked 1 years ago, Updated 1 years ago, 87 views

Hello.

The other day, I had a problem with the system that was in production.
障害 For details of the failure, please refer to
About garbled characters when adding java filter programs
See the .

As a countermeasure, I need to rearrange the filter-mapping, but I'm actually having trouble knowing where to put it.

[Environment]
OS:CentOS release 6.5(Final)
tomcat:6.0.39
apache —2.2.21
java:1.7.0_45

のCurrent filter-mapping <

<filter>
    <filter-name>encodingfilter</filter-name>
    <filter-class>org.seasar.extension.filter.EncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>Windows-31J</param-value>
    </init-param>
</filter>

<filter>
    <filter-name>requestDumpFilter</filter-name>
    <filter-class>org.seasar.extension.filter.RequestDumpFilter</filter-class>
</filter>

<filter>
    <filter-name>hotdeployfilter</filter-name>
    <filter-class>org.seasar.framework.container.hotdeploy.HotdeployFilter</filter-class>
</filter>

<filter>
    <filter-name>s2filter</filter-name>
    <filter-class>org.seasar.framework.container.filter.S2ContainerFilter</filter-class>
</filter>

<filter>
    <filter-name>routingfilter</filter-name>
    <filter-class>org.seasar.struts.filter.RoutingFilter</filter-class>
    <init-param>
        <param-name>jspDirectAccess</param-name>
        <param-value>false</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>encodingfilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
    <filter-name>hotdeployfilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

<filter-mapping>
    <filter-name>s2filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

<filter-mapping>
    <filter-name>NDCfilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
    <filter-name>routingfilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>

<filter-mapping>
    <filter-name>requestDumpFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

追加Filter-mapping I want to add >

<filter>
    <filter-name>NDCfilter</filter-name>
    <filter-class>util.NdcFilter</filter-class>
</filter>
<filter>
    <filter-name>NDCfilter</filter-name>
    <filter-class>util.NdcFilter</filter-class>
</filter>

"I know it's after ""encodingfilter"", but I regret that I caused the failure because I didn't understand the meaning of each filter in the first place, so I would like to know the meaning as well."

Therefore, I would appreciate it if you could let me know about the following two points.
①What role does each filter have?
②Where is the appropriate location to add the filter-mapping you want to add?

Thank you for your cooperation!

[Additional note (August 9)]
Dear A-pZ, Thank you for your comment.
The filter definition has also been added.
The framework uses struts.

If there is any other information missing, I will add it.

java tomcat

2022-09-30 20:54

1 Answers

It looks like SAStruts (Seasor2+Struts1).

Below is a brief explanation and a link to the official website (in Japanese).There is a brief introduction to the roles and their respective filters.

http://sastruts.seasar.org/fileReference.html

Also, as it is officially written, it says, "Be sure to define it in the order above," so if you change the order, it will not work properly.

What is not mentioned on the sastruts site is

RequestDumpFilter—A debug filter that prints the contents of a request (Http request).
http://s2container.seasar.org/2.4/ja/request_dump_filter.html

That's all.


2022-09-30 20:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.