I have a problem too with WCK
As a quick test I simply took WebdavFileStore's source and copied it into a com.test.mystores.TestStore class.
I then changed domain.xml from:
<nodestore classname="org.apache.slide.simple.store.WebdavStoreAdapter">
<!-- replace the above line with this one if your Slide version and your store supports macro operations on the store level --> <!--nodestore classname="org.apache.slide.simple.store.WebdavStoreMacroAdapter"-->
<parameter name="callback-store">org.apache.slide.simple.reference.WebdavFileStore</parameter>
<!-- this is where all the resources in the /files collection go to -->
<!-- adapt to your needs -->
<parameter name="rootpath">store</parameter>
</nodestore>
to:
<nodestore classname="org.apache.slide.simple.store.WebdavStoreAdapter">
<!-- replace the above line with this one if your Slide version and your store supports macro operations on the store level --> <!--nodestore classname="org.apache.slide.simple.store.WebdavStoreMacroAdapter"-->
<parameter name="callback-store">com.test.mystores.TestStore</parameter>
<!-- this is where all the resources in the /files collection go to -->
<!-- adapt to your needs -->
<parameter name="rootpath">store</parameter>
</nodestore>
Source: (exactly like WebdavFileStore except for changed class names)
"package com.test.mystores.;
import java.io.BufferedInputStream; ....
public class TestStore implements BasicWebdavStore, WebdavStoreLockExtension, WebdavStoreBulkPropertyExtension,
WebdavStoreMacroCopyExtension, WebdavStoreMacroMoveExtension, WebdavStoreMacroDeleteExtension {
private static final String ROOTPATH_PARAMETER = "rootpath";
private static final String LOCK_FILE_EXTENSION = ".lck";
private static final String PROPERTY_FILE_PREFIX = ".";
private static void save(InputStream is, File file) throws IOException {
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
try {
FileHelper.copy(is, os);
} finally {
try {
is.close();
} finally {
os.close();
}
}
}
private static File root = null;
private static Service service = null;
private static LoggerFacade logger = null;
public synchronized void begin(Service service, Principal principal, Object connection, LoggerFacade logger,
Hashtable parameters) throws ServiceAccessException, ServiceParameterErrorException,
ServiceParameterMissingException {
// set parameters only once...
if (TestStore.root == null) {
TestStore.service = service;
TestStore.logger = logger;
String rootPath = (String) parameters.get(ROOTPATH_PARAMETER);
if (rootPath == null)
throw new ServiceParameterMissingException(service, ROOTPATH_PARAMETER);
TestStore.root = new File(rootPath);
if (!TestStore.root.exists()) {
if (!TestStore.root.mkdirs()) {
throw new ServiceParameterErrorException(service, ROOTPATH_PARAMETER + ": " + TestStore.root
+ " does not exist and could not be created");
} else {
logger.logInfo("Created root folder at: " + rootPath);
}
}
}
}
....."
Anyways when WebdavFileStore is used - everything works fine. However when my custom class is used - it can't even find the root directory.... Is there something I'm doing wrong?
Roman D wrote:
Hi,
I am trying to run example WCK servlet for 3 days with no luck.
As far as I can understand from http://wiki.apache.org/jakarta-slide/WebDavConstructionKit
WCK has *org.apache.slide.simple.reference.WebdavFileStore* which is not a servlet.
It supposed to be used through Slide.
Domain.xml configures Slide to use whatever storage you like, or something like that.
Now, as I understand, I need to run Slide servlet *org.apache.slide.webdav.WebdavServlet* and use Domain.xml with
*<parameter name="callback-store">org.apache.slide.store.simple.WebdavFileStore</parameter>
*So I put *Domain.xml* in *WEB-INF/classes*.
Then add *slide-webdavservlet-2.2pre1.ja*r into *WEB-INF/lib*
Then add following to web.xml;
*<servlet-mapping> <servlet-name>org.apache.slide.webdav.WebdavServlet</servlet-name>*
Tomcat 5.0 says:
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name org.apache.slide.webdav.WebdavServlet
What do I do wrong? Do I understand slide/wck relationship correctly?
Thanks!
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
