Author: alevkovsky
Date: 2008-09-19 11:04:56 -0400 (Fri, 19 Sep 2008)
New Revision: 10510
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/TinyMceLoaderServlet.java
Log:
Adjust servlet code in Editor
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/TinyMceLoaderServlet.java
===================================================================
---
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/TinyMceLoaderServlet.java 2008-09-19
14:35:17 UTC (rev 10509)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/TinyMceLoaderServlet.java 2008-09-19
15:04:56 UTC (rev 10510)
@@ -12,20 +12,24 @@
import org.apache.commons.logging.LogFactory;
/**
- * Servlet implementation class for Servlet: TinyMCELoaderServlet
+ * Servlet for loading TinyMCE resources
*
* @web.servlet name="TinyMCELoaderServlet" display-name="TinyMCE Loader
Servlet"
*
- * @web.servlet-mapping
url-pattern="/org/richfaces/renderkit/html/scripts/tiny_mce/*"
+ * @web.servlet-mapping
url-pattern="/a4j/g/3_3_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/tiny_mce/*"
*
+ * @author Alexandr Levkovsky
+ *
*/
public class TinyMceLoaderServlet extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
- private static final long serialVersionUID = 2134922212552082105L;
+ private static final long serialVersionUID = 1L;
protected final Log logger = LogFactory.getLog(getClass());
+
+ private static final String TINYMCE_RESOURCES_LOCATION =
"org/richfaces/renderkit/html/scripts/tiny_mce";
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException {
- String path = "org/richfaces/renderkit/html/scripts/tiny_mce" +
request.getPathInfo();
+ String path = TINYMCE_RESOURCES_LOCATION + request.getPathInfo();
try {
copyFileToOutput(path, response.getOutputStream());
@@ -36,19 +40,24 @@
}
- /** Opens Input Stream for
- *
+ /**
+ * Open input stream using path to file
* @param path
* @return
*/
- public InputStream getFileStream(String path) {
+ private InputStream getFileStream(String path) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(path);
return is;
}
- public void copyFileToOutput(String path, OutputStream os) {
+ /**
+ * Copies file to output stream
+ * @param path
+ * @param os
+ */
+ private void copyFileToOutput(String path, OutputStream os) {
InputStream is = getFileStream(path);
try {
Show replies by date