Suppose there are the following scenarios. When we develop a plug-in of which servlet access is allowed, if no authentication is required or there are other security mechanisms, instead of performing an authentication of each time, we can directly access the servlet. The code for bypassing authentication is as follows:
@ Overridepublic void initializeplugin (pluginmanager manager, file plugindirectory) {// access the servlet authcheckfilter of plugin directly by bypassing logon. addexclude ("fchatplugin/servlet");} @ overridepublic void destroyplugin () {// access the servlet authcheckfilter of plugin directly by bypassing logon. removeexclude ("fchatplugin/servlet ");}
The servlet configuration file for reference is as follows:
1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 3 <web-app> 4 <servlet> 5 <servlet-class>com.demo.fchatPlugin.SafeServlet</servlet-class> 6 <servlet-name>SafeServlet</servlet-name> 7 </servlet> 8 9 <servlet-mapping>10 <servlet-name>SafeServlet</servlet-name>11 <url-pattern>/servlet</url-pattern>12 </servlet-mapping>13 </web-app>
Now you can directly access the address: http: // localhost: 9090/plugins/fchatplugin/Servlet