#2229: Java Connector: enable file upload to directory outside webapp context
root
-----------------------------+----------------------------------------------
Reporter: AndrewCottrell | Owner:
Type: New Feature | Status: new
Priority: Normal | Milestone:
Component: Server : Java | Version:
Resolution: | Keywords: Pending
-----------------------------+----------------------------------------------
Comment (by AndrewCottrell):
Thanks for taking time to review my request. I'm sorry I didn't make it
clearer.
I deploy my webapp to ''${catalina.home}/webapps/ROOT'' on each of four
servers.
My problem is that
{{{
String typeDirPath = getServletContext().getRealPath(typePath);
}}}
returns the wrong directory (although ''typePath'' is correct).
Each server has a 'shared' directory mounted as ''/mnt/shared''
In each ''server.xml'' file I have:
{{{
<Context path="/shared" docBase="/mnt/shared" />
}}}
So, I want ''typePath'' to get the value "/shared/fckeditor/image" and I
want ''typeDirPath'' to get the value "/mnt/shared/fckeditor/image"
For security reasons I'm unable set symlinks. I have now patched
''fckeditor-java-core-2.4-beta-1.jar'' to do what I need.
I modified ''doGet'' and ''doPost'' in ''ConnectorServlet'' with
{{{
String typeDirPath = UtilsResponse.constructSystemFilePath(request,
resourceType, currentFolderStr);
}}}
and added ''constructSystemFilePath'' to ''UtilsResponse''. That method is
almost the same as
''constructResponseUrl'' and calls
''ConnectorHandler.getUserSystemFilesPath(request)'' which in turn calls
''RequestCycleHandler.getUserSystemFilePath(servletRequest)'' which calls
''userPathBuilder.getUserSystemFilesPath(request)''. Obviously I added
''getUserSystemFilesPath'' to ''UserPathBuilder''.
This change allows me to implement different code for determining the
''typePath'' and the ''typeDirPath''. I doubt that my patch would be
useful for anyone else. I'm sure you could implement the same
functionality in a much more maintainable way.
btw, I ran into a problem in ''ConnectorServlet.doGet'' where the
''currentFolderStr'' value appears twice in ''currentDir''. I think this
may be a bug in ''fckeditor-java-core-2.4-beta-1''. I fixed this issue by
replacing
{{{
File currentDir = new File(typeDir, currentFolderStr);
}}}
with
{{{
File currentDir = typeDir;
}}}
[I got a database error when I tried to submit this reply. Will try again.
Sorry if multiple copies of this reply end up online.]
--
Ticket URL: <http://dev.fckeditor.net/ticket/2229#comment:3>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac