Integrating CKFinder with your Application

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

After you download the CKFinder for Java .war file, follow the steps below to integrate it with your application:

  • Unpack CKFinder for Java.
  • Copy the ckfinder folder to your application.
  • Copy the CKFinder config.xml file from its WEB-INF folder into the WEB-INF folder of your application.
  • Copy the contents of the CKFinder WEB-INF/lib folder into the WEB-INF/lib folder of your application.
  • Copy the ConnectorServlet settings from the CKFinder web.xml file to the web.xml file of your application. Note that the <servlet-class> path and <url-pattern> will need to be adjusted to your application.
<servlet>
	<servlet-name>ConnectorServlet</servlet-name>
	<servlet-class>com.ckfinder.connector.ConnectorServlet</servlet-class>
	<init-param>
		<param-name>XMLConfig</param-name>
		<param-value>/WEB-INF/config.xml</param-value>
	</init-param>
	<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
	<servlet-name>ConnectorServlet</servlet-name>
	<url-pattern>
		/ckfinder/core/connector/java/connector.java
	</url-pattern>
</servlet-mapping>
  • Just like in the sample application, by default CKFinder is disabled due to security reasons. To turn it on, change the <enabled> element value in the config.xml file to true.
<enabled>true</enabled>
  • Similarily, some further adjustments of the config.xml file might be needed, like baseUrl and baseDir paths, for example.

CKFinder implements some access control that is available from your application. You can create a class that inherits and extends the Configuration class. A sample code can be seen below:

public class MyConfiguration extends Configuration {

	public MyConfiguration(ServletConfig servletConfig) {
		super(servletConfig);
	}

	@Override
	public Boolean checkAuthentication() {
		return false;
	}
}

Special attention should be paid to the checkAuthentication method. It can be used to specify the pre-requisites (like administrator rights) that have to be met in order to make CKFinder available.

This option is obviously not the only one that you can control. You can override each of the Configuration class methods that represent CKFinder setting, including enabling and disabling CKFinder.