Dynamic path for Images with Java
I work in a project where I had to set a dynamic path for the images, as we where using Iplanet I choosed the Java Connector and this are the changes I made in order for FCKeditor to manage the images of the webpage being seen (the images in my project where hosted at the sema directory level as the web page), of course you can change a bit the whole procedure in order to point to the directory of your choice (I had to get rid of the Image directory )
1)
web.xml
There is nothing to change you use the default parameters anyway they will be overided
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserDir/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- ==================================================================== -->
<!-- From rules.properties -->
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
2)
In the fckconfig.js of course you have to change the connectors (those 3 lines)
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;
FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;
And I'm not gonna comment on the way to configurate the web server in order to work with the FCKeditor taglibs, it is already commented here somewhere. There is something about taking out the tld files from the jar file.
3)
My jsp page (editor.jsp):
<%
String basehref="";
String urlpasse = request.getParameter("urlpasse");
if (urlpasse==null || urlpasse.equals("")) urlpasse = "";
if (!(urlpasse.equals("")))
{
StringTokenizer token=new StringTokenizer(urlpasse,"/");
basehref=urlpasse.substring(0,urlpasse.lastIndexOf("/")+1);
urlpasse=urlpasse.substring(urlpasse.indexOf("/doc/"));
}
String imageBrowserURLS="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector&Basep="+urlpasse.substring(0,urlpasse.lastIndexOf("/"));
%>
<html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <link href="../sample.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../../fckeditor.js"></script> </head> <body> <h1>EditionFCKeditor - JSP - Sample 7</h1> <hr> <form action="sampleposteddata.jsp" method="post" target="_blank"> <FCK:editor id="EditorDefault" basePath="/FCKeditor/" fullPage="true" height="80%" width="80%" baseHref="<%=basehref%>" imageBrowserURL="<%=imageBrowserURLS%>" linkBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" flashBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" imageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image" linkUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File" flashUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><jsp:include page="<%=urlpasse%>" /> </FCK:editor> <br> <input type="submit" value="Submit"> </form> </body> </html>