J.swiderski (talk | contribs) |
J.swiderski (talk | contribs) |
||
Line 35: | Line 35: | ||
==File Upload Filter== | ==File Upload Filter== | ||
− | As described in Troubleshooting, Flash Upload Problem section, if you are using Flash multi file upload component together with session based authentication you might get some "missing cookies" problems when trying to upload files. To workaround this Flash bug you have to take care of posting cookies your self. On server side this is done by <code>FileUploadFilter</code>: | + | As described in Troubleshooting, [[http://docs.cksource.com/CKFinder_2.x/Developers_Guide/Java/Troubleshooting#Flash_Upload_Problem Flash Upload Problem]] section, if you are using Flash multi file upload component together with session based authentication you might get some "missing cookies" problems when trying to upload files. To workaround this Flash bug you have to take care of posting cookies your self. On server side this is done by <code>FileUploadFilter</code>: |
<source lang="xml"> | <source lang="xml"> | ||
<filter> | <filter> | ||
Line 57: | Line 57: | ||
As you can see, besides basic elements like name, full class declaration (<code><filter-class></code>) and mapping applying filter to specific URL (has to be the same mapping as for <code>ConnectorServlet</code>), there are also two optional configuration parameters which help to identify "authentication cookies" that need to be rewritten. | As you can see, besides basic elements like name, full class declaration (<code><filter-class></code>) and mapping applying filter to specific URL (has to be the same mapping as for <code>ConnectorServlet</code>), there are also two optional configuration parameters which help to identify "authentication cookies" that need to be rewritten. | ||
− | Those parameters are name for the session cookie (sessionCookieName) which in Java defaults to "JSESSIONID" value and name for the session path parameter (sessionParameterName) which in Java defaults to "jsessionid". As said before those parameters are optional and can be omitted. However if you are using custom configuration and you have changed names for those session identifiers on your server you should also specify them in <code> | + | Those parameters are name for the session cookie (<code>sessionCookieName</code>) which in Java defaults to "JSESSIONID" value and name for the session path parameter (<code>sessionParameterName</code>) which in Java defaults to "jsessionid". As said before those parameters are optional and can be omitted. However if you are using custom configuration and you have changed names for those session identifiers on your server you should also specify them in <code>FileUploadFilter</code> init parameters so that CKFinder could know what to rewrite. |
== Installing CKFinder as a JSP Page Tag == | == Installing CKFinder as a JSP Page Tag == |
Revision as of 17:22, 9 September 2011
Contents
This article describes various ways of integrating CKFinder for Java with your page.
Integrating CKFinder with your Application
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 itsWEB-INF
folder into theWEB-INF
folder of your application. - Copy the contents of the CKFinder
WEB-INF/lib
folder into theWEB-INF/lib
folder of your application. - Copy the
ConnectorServlet
settings from the CKFinderweb.xml
file to theweb.xml
file of 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 theconfig.xml
file totrue
. Note that it is recommended to use a more fine-grained authentication method by overriding thecheckAuthentication
method.
<enabled>true</enabled>
- Similarily, some further adjustments of the
config.xml
file might be needed, likebaseUrl
andbaseDir
paths, for example.
File Upload Filter
As described in Troubleshooting, [Flash Upload Problem] section, if you are using Flash multi file upload component together with session based authentication you might get some "missing cookies" problems when trying to upload files. To workaround this Flash bug you have to take care of posting cookies your self. On server side this is done by FileUploadFilter
:
<filter> <filter-name>FileUploadFilter</filter-name> <filter-class>com.ckfinder.connector.FileUploadFilter</filter-class> <init-param> <param-name>sessionCookieName</param-name> <param-value>JSESSIONID</param-value> </init-param> <init-param> <param-name>sessionParameterName</param-name> <param-value>jsessionid</param-value> </init-param> </filter> <filter-mapping> <filter-name>FileUploadFilter</filter-name> <url-pattern>/ckfinder/core/connector/java/connector.java</url-pattern> </filter-mapping>
As you can see, besides basic elements like name, full class declaration (<filter-class>
) and mapping applying filter to specific URL (has to be the same mapping as for ConnectorServlet
), there are also two optional configuration parameters which help to identify "authentication cookies" that need to be rewritten.
Those parameters are name for the session cookie (sessionCookieName
) which in Java defaults to "JSESSIONID" value and name for the session path parameter (sessionParameterName
) which in Java defaults to "jsessionid". As said before those parameters are optional and can be omitted. However if you are using custom configuration and you have changed names for those session identifiers on your server you should also specify them in FileUploadFilter
init parameters so that CKFinder could know what to rewrite.
Installing CKFinder as a JSP Page Tag
In order to install CKFinder as a tag inside a .jsp
page, follow the steps outlined below:
- Install CKFinder as described in the section above.
- In order to use the tag on the JSP page you should import the tag library by using the following directive:
<%@ taglib uri="http://ckfinder.com" prefix="ckfinder" %>
You can now use the CKFinder tag on your JSP page in the following way:
<ckfinder:ckfinder basePath="/CKFinderJava/ckfinder/" />
The only required attribute is the basePath
that specifies the path to the CKFinder folder. Numerous optional attributes are also available and can be used to customize CKFinder to your needs, like in the example below:
<ckfinder:ckfinder basePath="/CKFinderJava/ckfinder/" width="700" height="500" />
This code creates a CKFinder instance with a width of 700 pixels and height of 500 pixels.
Extending Configuration
The MyConfiguration
class lets you change the base CKFinder configuration, or, in other words, change the settings from the XML file at the Java class level. To read more about extending your CKFinder configuration, refer to the Extending CKFinder Configuration article.
Integration methods
- JavaScript integration – the preferred integration method, simple yet powerful.