Commit 909ee0c5 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Modified install4j file; added support for plugin servlet filters (JM-718).

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4015 b35dd754-fafc-0310-a699-88a17e54d16e
parent 91c6bf3a
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<install4j version="3.2.2"> <install4j version="3.2.4">
<directoryPresets config="../../target/release/wildfire/lib" /> <directoryPresets config="../../target/release/wildfire/lib" />
<application name="%APP_NAME%" distributionSourceDir="" applicationId="%APPLICATION_ID%" mediaDir="../../target/release" mediaFilePattern="%FILE_PREFIX%_%VERSION_MAJOR%_%VERSION_MINOR%_%VERSION_REVISION%" compression="9" lzmaCompression="true" keepModificationTimes="true" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="true" macSignature="????" javaMinVersion="1.5" javaMaxVersion="" allowBetaVM="false"> <application name="%APP_NAME%" distributionSourceDir="" applicationId="%APPLICATION_ID%" mediaDir="../../target/release" mediaFilePattern="%FILE_PREFIX%_%VERSION_MAJOR%_%VERSION_MINOR%_%VERSION_REVISION%" compression="9" lzmaCompression="true" keepModificationTimes="true" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="true" macSignature="????" javaMinVersion="1.5" javaMaxVersion="" allowBetaVM="false">
<searchSequence> <searchSequence>
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<envVar name="JDK_HOME" /> <envVar name="JDK_HOME" />
</searchSequence> </searchSequence>
<variables> <variables>
<variable name="VERSION_MAJOR" value="2" /> <variable name="VERSION_MAJOR" value="3" />
<variable name="VERSION_MINOR" value="4" /> <variable name="VERSION_MINOR" value="0" />
<variable name="VERSION_REVISION" value="0" /> <variable name="VERSION_REVISION" value="0" />
<variable name="APP_NAME" value="Wildfire" /> <variable name="APP_NAME" value="Wildfire" />
<variable name="APP_SHORT_NAME" value="wildfire" /> <variable name="APP_SHORT_NAME" value="wildfire" />
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
<customScreens /> <customScreens />
</installerGui> </installerGui>
<mediaSets> <mediaSets>
<win32 name="Windows" id="3" mediaFileName="" installDir="%WINDOWS_INSTALL_DIR%" allLaunchers="false" includedJRE="windows-x86-1.5.0_06_server" manualJREEntry="false" bundleType="1" jreURL="" jreFtpURL="" jreShared="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="12" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="true" languageID="en" modeDesktopIcon="1" desktopLauncherId="12" programGroup="%APP_NAME%" allowUserDisableStartMenuCreation="true" reboot="false" rebootUninstaller="false" modeQuickLaunchIon="1"> <win32 name="Windows" id="3" mediaFileName="" installDir="%WINDOWS_INSTALL_DIR%" allLaunchers="false" includedJRE="windows-x86-1.5.0_07_server" manualJREEntry="false" bundleType="1" jreURL="" jreFtpURL="" jreShared="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="12" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="true" languageID="en" modeDesktopIcon="1" desktopLauncherId="12" programGroup="%APP_NAME%" allowUserDisableStartMenuCreation="true" reboot="false" rebootUninstaller="false" modeQuickLaunchIon="1">
<selectedLaunchers> <selectedLaunchers>
<launcher id="2" /> <launcher id="2" />
<launcher id="12" /> <launcher id="12" />
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<entry name="Readme" target="README.html" icon="" /> <entry name="Readme" target="README.html" icon="" />
</additionalStartMenuEntries> </additionalStartMenuEntries>
</win32> </win32>
<linuxRPM name="Linux RPM" id="18" mediaFileName="" installDir="/opt/%UNIX_INSTALL_DIR%" allLaunchers="false" includedJRE="linux-x86-1.5.0_06" manualJREEntry="false" customScriptMode="1" customScriptFile="" os="linux" arch="i386"> <linuxRPM name="Linux RPM" id="18" mediaFileName="" installDir="/opt/%UNIX_INSTALL_DIR%" allLaunchers="false" includedJRE="linux-x86-1.5.0_07" manualJREEntry="false" customScriptMode="1" customScriptFile="" os="linux" arch="i386">
<selectedLaunchers> <selectedLaunchers>
<launcher id="22" /> <launcher id="22" />
</selectedLaunchers> </selectedLaunchers>
......
/**
* $RCSfile$
* $Revision: 1709 $
* $Date: 2005-07-26 11:55:27 -0700 (Tue, 26 Jul 2005) $
*
* Copyright (C) 2006 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.admin;
import javax.servlet.*;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* A servlet filter that plugin classes can use to dynamically register and un-register
* filter logic. The filter logic that each plugin can register is fairly limited;
* instead of having full control over the filter chain, each instance of
* {@link SimpleFilter} only has the ability to use the ServletRequest and ServletResponse
* objects and then return <tt>true</tt> if further filters in the chain should be run.
*
* @author Matt Tucker
*/
public class PluginFilter implements Filter {
private static List<SimpleFilter> pluginFilters = new CopyOnWriteArrayList<SimpleFilter>();
/**
* Adds a filter to the list of filters that will be run on every request.
* This method should be called by plugins when starting up.
*
* @param filter the filter.
*/
public static void addPluginFilter(SimpleFilter filter) {
pluginFilters.add(filter);
}
/**
* Removes a filter from the list of filters that will be run on every request.
* This method should be called by plugins when shutting down.
*
* @param filter the filter.
*/
public static void removePluginFilter(SimpleFilter filter) {
pluginFilters.remove(filter);
}
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException
{
boolean continueChain = true;
// Process each plugin filter.
for (SimpleFilter filter : pluginFilters) {
if (!filter.doFilter(servletRequest, servletResponse)) {
// The filter returned false so no further filters in the
// chain should be run.
continueChain = false;
break;
}
}
if (continueChain) {
filterChain.doFilter(servletRequest, servletResponse);
}
}
public void destroy() {
// If the destroy method is being called, the Wildfire instance is being shutdown.
// Therefore, clear out the list of plugin filters.
pluginFilters.clear();
}
/**
* A simplified version of a servlet filter. Instead of having full control
* over the filter chain, a simple filter can only control whether further
* filters in the chain are run.
*/
public interface SimpleFilter {
/**
* The doFilter method of the Filter is called by the PluginFilter each time a
* request/response pair is passed through the chain due to a client request
* for a resource at the end of the chain. This method should return <tt>true</tt> if
* the additional filters in the chain should be processed or <tt>false</tt>
* if no additional filters should be run.<p>
*
* Note that the filter will apply to all requests for JSP pages in the admin console
* and not just requests in the respective plugins. To only apply filtering to
* individual plugins, examine the context path of the request and only filter
* relevant requests.
*
* @param request the servlet request.
* @param response the servlet response
* @throws IOException if an IOException occurs.
* @throws ServletException if a servlet exception occurs.
* @return true if further filters in the chain should be run.
*/
public boolean doFilter(ServletRequest request, ServletResponse response)
throws IOException, ServletException;
}
}
\ No newline at end of file
...@@ -111,9 +111,9 @@ public class PluginServlet extends HttpServlet { ...@@ -111,9 +111,9 @@ public class PluginServlet extends HttpServlet {
* Registers all JSP page servlets for a plugin. * Registers all JSP page servlets for a plugin.
* *
* @param manager the plugin manager. * @param manager the plugin manager.
* @param plugin the plugin. * @param plugin the plugin.
* @param webXML the web.xml file containing JSP page names to servlet class file * @param webXML the web.xml file containing JSP page names to servlet class file
* mappings. * mappings.
*/ */
public static void registerServlets(PluginManager manager, Plugin plugin, File webXML) { public static void registerServlets(PluginManager manager, Plugin plugin, File webXML) {
pluginManager = manager; pluginManager = manager;
......
...@@ -27,7 +27,12 @@ ...@@ -27,7 +27,12 @@
</init-param> </init-param>
</filter> </filter>
<filter> <filter>
<filter-name>PluginFilter</filter-name>
<filter-class>org.jivesoftware.admin.PluginFilter</filter-class>
</filter>
<filter>
<filter-name>Set Character Encoding</filter-name> <filter-name>Set Character Encoding</filter-name>
<filter-class>org.jivesoftware.util.SetCharacterEncodingFilter</filter-class> <filter-class>org.jivesoftware.util.SetCharacterEncodingFilter</filter-class>
</filter> </filter>
...@@ -46,6 +51,11 @@ ...@@ -46,6 +51,11 @@
<filter-name>AuthCheck</filter-name> <filter-name>AuthCheck</filter-name>
<url-pattern>*.jsp</url-pattern> <url-pattern>*.jsp</url-pattern>
</filter-mapping> </filter-mapping>
<filter-mapping>
<filter-name>PluginFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping> <filter-mapping>
<filter-name>Set Character Encoding</filter-name> <filter-name>Set Character Encoding</filter-name>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment