Od poprzeczne 2.1.3, dodatek wywołanie metody stosuje się w doFilter()
metody FilterDispatcher aby wyświetlić komunikat ostrzegawczy.
showDeprecatedWarning()
drukuje wiadomość na konsoli. To po prostu System.out.println().
public void doFilter(....){
showDeprecatedWarning();
........
}
private void showDeprecatedWarning() {
String msg =
"\n\n" +
"***********************************************************************\n" +
"* WARNING!!! *\n" +
"* *\n" +
"* >>> FilterDispatcher <<< is deprecated! Please use the new filters! *\n" +
"* *\n" +
"* This can be a source of unpredictable problems! *\n" +
"* *\n" +
"* Please refer to the docs for more details! *\n" +
"* http://struts.apache.org/2.x/docs/webxml.html *\n" +
"* *\n" +
"***********************************************************************\n\n";
System.out.println(msg);
}
Ale Struts2 zaleca stosowanie org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
zamiast org.apache.struts2.dispatcher.FilterDispatcher
.
konfiguracyjny web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
Link wyposażony ostrzeżenia już nie działa, niestety. Przynajmniej nie dla mnie. –
@ S.Buda Dobry punkt; Zobaczę, czy to się zmieniło w późniejszych wydaniach. –
Używam podpórek 2.3.20 (najnowsza wersja) i podany tam link nie działa. Myślę, że to był ten sam adres URL. Właściwie to miałem wiele problemów z linkami do dokumentacji strutsów, która ostatnio nie działa. –