No one's known who wrote such a component, but if you are able to implement the net.fckeditor.connector.Connector interface for Spring in a general way, we could intergrate it into the main package. However, the code has to be general enough to be included.
I`ve created a new spring-connector maven project in fckeditor. As there`s spring dependencies I thought it would be better in a seperate project. There`s a servlet in the project called FCKSpringConnectorServlet which derives from the ConnectorServlet and uses the WebApplication context to inject the bean into the dispatcher.
I had to change the ConnectorServlet so the dispatcher member variable is protected and I also had to change the dispatcher so a connector could be passed into a constructor.
The Conenctor spring bean is looked up using a default bean name of FCKEditorConnector or a servlet init param can be passed in in the web.xml. The java-demo project uses a servlet init param as an example
I`ve also updated the java-demo project to have an additional jsp to upload and retrieve images from the server using a sample FCKEditorConnector Spring bean.This spring bean implements the Connector interface in the java-core project
Ideally the SpringConnectorServlet won`t derive from ConnectorServlet instead a delgate could be used for common behaviour between the 2 servlets. However deriving from it seemed the easiest option for prove of concept.
If FCKEditor java integration team are interested in this how should I check in the code?Should it be on a seperate branch or shall I check into trunk?
See below for SpringConnectorServlet
public class FCKSpringConnectorServlet extends ConnectorServlet{
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(FCKSpringConnectorServlet.class);
public static final String FCKEDITOR_SPRING_CONNECTOR_INIT_PARAM = "FCKEDITOR_SPRING_CONNECTOR";
public static final String FCKEDITOR_DEFAULT_CONNECTOR_BEAN_NAME = "FCKEditorConnector";
@Override
public void init() throws ServletException {
try {
WebApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
//Try to look up the Connector bean name from
//web.xml. If it can`t be found then use the default name
String connectorBeanName =
getInitParameter(FCKEDITOR_SPRING_CONNECTOR_INIT_PARAM);
Connector connector = null;
if(connectorBeanName !=null && connectorBeanName.trim().length()>0){
connector = (Connector)ctx.getBean(connectorBeanName);
}else{
connector = (Connector)ctx.getBean(FCKEDITOR_DEFAULT_CONNECTOR_BEAN_NAME);
}
dispatcher = new Dispatcher(connector);
} catch (Exception e) {
logger.error("Dispatcher could not be initialized", e);
throw new ServletException(e);
}
}
}
Re: FCKEditor 2.5 Spring Connector
Re: FCKEditor 2.5 Spring Connector
There`s a servlet in the project called FCKSpringConnectorServlet which derives from the ConnectorServlet and uses the WebApplication context to inject the bean into the dispatcher.
I had to change the ConnectorServlet so the dispatcher member variable is protected and I also had to change the dispatcher so a connector could be passed into a constructor.
The Conenctor spring bean is looked up using a default bean name of FCKEditorConnector or a servlet init param can be passed in in the web.xml. The java-demo project uses a servlet init param as an example
I`ve also updated the java-demo project to have an additional jsp to upload and retrieve images from the server using a sample FCKEditorConnector Spring bean.This spring bean implements the Connector interface in the java-core project
Ideally the SpringConnectorServlet won`t derive from ConnectorServlet instead a delgate could be used for common behaviour between the 2 servlets.
However deriving from it seemed the easiest option for prove of concept.
If FCKEditor java integration team are interested in this how should I check in the code?Should it be on a seperate branch or shall I check into trunk?
See below for SpringConnectorServlet
public class FCKSpringConnectorServlet extends ConnectorServlet{ private static final long serialVersionUID = 1L; private static final Logger logger = LoggerFactory.getLogger(FCKSpringConnectorServlet.class); public static final String FCKEDITOR_SPRING_CONNECTOR_INIT_PARAM = "FCKEDITOR_SPRING_CONNECTOR"; public static final String FCKEDITOR_DEFAULT_CONNECTOR_BEAN_NAME = "FCKEditorConnector"; @Override public void init() throws ServletException { try { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); //Try to look up the Connector bean name from //web.xml. If it can`t be found then use the default name String connectorBeanName = getInitParameter(FCKEDITOR_SPRING_CONNECTOR_INIT_PARAM); Connector connector = null; if(connectorBeanName !=null && connectorBeanName.trim().length()>0){ connector = (Connector)ctx.getBean(connectorBeanName); }else{ connector = (Connector)ctx.getBean(FCKEDITOR_DEFAULT_CONNECTOR_BEAN_NAME); } dispatcher = new Dispatcher(connector); } catch (Exception e) { logger.error("Dispatcher could not be initialized", e); throw new ServletException(e); } } }Re: FCKEditor 2.5 Spring Connector