Reputation: 12663
I am using CKFinder-2.2 with CKEditor-3.5.X and all was well until I tried to upload an image/file and send that to image. I got the following error when I tried to send the file to the server No mapping found for HTTP request with URI [/my-project/ckfinder/core/connector/java/connector.java] in DispatcherServlet with name 'appServlet'
. I am using Spring MVC 3 for this web application.
The browse server button with upload button works just fine as I made the required changes in the <url-pattern>
in web.xml
to get it working, but I can't send the file to the server using the send it to the server button.
I think the error occurred due to following lines in CKFinderSetupCKEditor.java
:
private static final String CKFINDER_UPLOAD_URL = "/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=";
private static final String CKFINDER_PAGE = "/ckfinder.html";
I tried the config
attribute of <ckeditor:replace>
as well as mentioned below but that did not help either.
<%@ page import="com.ckeditor.CKEditorConfig" %>
<%
CKEditorConfig settings = new CKEditorConfig();
settings.addConfigValue("filebrowserUploadUrl", "/my-project/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files");
settings.addConfigValue("filebrowserImageUploadUrl", "/my-project/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images");
settings.addConfigValue("filebrowserFlashUploadUrl", "/my-project/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash");
%>
<ckfinder:setupCKEditor basePath="/my-project/resources/ckfinder/" editor="editor1" />
<ckeditor:replace replace="editor1" basePath="/my-project/resources/ckeditor/" config="<%=setting>"/>
Could someone help me understand what am I doing wrong here and how to get it done? It's just a file I want to upload to my server. It should not be too difficult.
Upvotes: 2
Views: 5307
Reputation: 12663
In case someone comes across the same issue, adding the following got things working for me:
web.xml
<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>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ConnectorServlet</servlet-name>
<url-pattern>
/resources/ckfinder/core/connector/java/connector.java
</url-pattern>
</servlet-mapping>
<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>
/resources/ckfinder/core/connector/java/connector.java
</url-pattern>
</filter-mapping>
.jsp file where you want ckeditor and ckfinder integrated to the textarea
<%@ page import="com.ckeditor.CKEditorConfig" %>
<%
CKEditorConfig settings = new CKEditorConfig();
settings.addConfigValue("filebrowserBrowseUrl","/myapp/resources/ckfinder/ckfinder.html");
settings.addConfigValue("filebrowserImageBrowseUrl","/myapp/resources/ckfinder/ckfinder.html?type=Images");
settings.addConfigValue("filebrowserFlashBrowseUrl","/myapp/resources/ckfinder/ckfinder.html?type=Flash");
settings.addConfigValue("filebrowserUploadUrl","/myapp/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files");
settings.addConfigValue("filebrowserImageUploadUrl","/myapp/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images");
settings.addConfigValue("filebrowserFlashUploadUrl","/myapp/resources/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash");
%>
<ckeditor:replace replace="editor1" basePath="/myapp/resources/ckeditor/" config="<%=settings %>" />
Upvotes: 1