import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.webdav.client.methods.CheckoutMethod;
import org.apache.jackrabbit.webdav.client.methods.PutMethod;
public class WebDavTest {
+ private final static Log log = LogFactory.getLog(WebDavTest.class);
/**
* @param args
client.setHostConfiguration(hostConfig);
// return client;
+ String baseUrl = "http://localhost:7070/org.argeo.server.jackrabbit.webapp/default/";
+
String fileName = "test.xml";
- PutMethod pm = new PutMethod(
- "http://localhost:7070/org.argeo.server.jackrabbit.webapp/default/"
- + fileName);
- // String text = "this is the document content";
+
+ // PUT
+ PutMethod pm = new PutMethod(baseUrl + fileName);
RequestEntity requestEntity = new InputStreamRequestEntity(
new FileInputStream(fileName));
- // pm.setRequestEntity(new StringRequestEntity(text, "text/plain",
- // null));
- // pm.setRequestBody(text);
pm.setRequestEntity(requestEntity);
client.executeMethod(pm);
+
+ // GET
+ CheckoutMethod gm = new CheckoutMethod(baseUrl + fileName);
+ client.executeMethod(gm);
+ String responseGet = gm.getResponseBodyAsString();
+ log.debug("CHECKOUT: " + responseGet);
} catch (Exception e) {
e.printStackTrace();
}
${basedir}/../modules;in=*;ex=pom.xml;ex=target;ex=.*,
${basedir}/../../server/modules;in=*;ex=pom.xml;ex=target;ex=.*,
</argeo.osgi.bundles>
+ <org.osgi.framework.bootdelegation>com.sun.jndi.ldap</org.osgi.framework.bootdelegation>
</systemProperties>
</configuration>
</plugin>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.argeo.commons.security</groupId>
<artifactId>org.argeo.dep.osgi.springframework.ldap</artifactId>
</dependency>
+
<!-- Security -->
+ <dependency>
+ <!--
+ Force inclusion of commons.lang to prevent v2.1.0 to be taken by
+ Spring Security
+ -->
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.lang</artifactId>
+ </dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>org.springframework.security</artifactId>
<groupId>org.argeo.dep.osgi</groupId>
<artifactId>org.argeo.dep.osgi.jackrabbit</artifactId>
</dependency>
+
+ <!-- For webdav -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web.servlet</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>com.springsource.javax.servlet</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
javax.servlet,
javax.servlet.http,
javax.servlet.resources,
- org.apache.jackrabbit.j2ee,
+ org.argeo.server.jackrabbit.webdav,
org.springframework.osgi.web.context.support,
org.springframework.web.context,
- org.springframework.web.servlet.handler,
- org.springframework.web.servlet
+ org.springframework.web.servlet,
+ org.springframework.web.servlet.handler
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
- <bean id="webdavServlet" class="org.apache.jackrabbit.j2ee.SimpleWebdavServlet">
+ <bean id="webdavServlet" class="org.argeo.server.jackrabbit.webdav.SimpleWebDavServlet">
<property name="repository" ref="repository" />
+ <property name="resourceConfiguration" value="osgibundle:/WEB-INF/config.xml" />
</bean>
<bean
</plugins>
</build>
<dependencies>
+ <dependency>
+ <groupId>org.argeo.commons.basic</groupId>
+ <artifactId>org.argeo.basic.nodeps</artifactId>
+ <version>0.1.2-SNAPSHOT</version>
+ </dependency>
+
<!-- Apache DS -->
<dependency>
<groupId>org.apache.directory</groupId>
import org.apache.directory.server.configuration.MutableServerStartupConfiguration;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.jndi.ServerContextFactory;
+import org.argeo.ArgeoException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
try {
new InitialDirContext(env);
} catch (NamingException e) {
- throw new RuntimeException(
- "Failed to start Apache Directory server", e);
+ throw new ArgeoException("Failed to start Apache Directory server",
+ e);
}
}
try {
new InitialContext(env);
} catch (NamingException e) {
- throw new RuntimeException(
- "Failed to stop Apache Directory server", e);
+ throw new ArgeoException("Failed to stop Apache Directory server",
+ e);
}
if (workingDirectory.exists() && deleteWorkingDirOnExit) {
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.argeo.commons.server</groupId>
</plugins>
</build>
<dependencies>
+ <dependency>
+ <groupId>org.argeo.commons.basic</groupId>
+ <artifactId>org.argeo.basic.nodeps</artifactId>
+ <version>0.1.2-SNAPSHOT</version>
+ </dependency>
+
+
<!-- Apache Commons -->
<dependency>
<groupId>org.apache.commons</groupId>
package org.argeo.server;
-public class ArgeoServerException extends RuntimeException {
+import org.argeo.ArgeoException;
+
+/** @deprecated use {@link ArgeoException} instead */
+public class ArgeoServerException extends ArgeoException {
private static final long serialVersionUID = 1L;
public ArgeoServerException() {
import java.io.StringWriter;
import org.apache.commons.io.IOUtils;
+import org.argeo.ArgeoException;
/** Answer to an execution of a remote service which performed changes. */
public class ServerAnswer {
public ServerAnswer(String status, String message) {
setStatus(status);
if (message == null)
- throw new ArgeoServerException("Message cannot be null");
+ throw new ArgeoException("Message cannot be null");
this.message = message;
}
public void setStatus(String status) {
if (status == null || (!status.equals(OK) && !status.equals(ERROR)))
- throw new ArgeoServerException("Bad status format: " + status);
+ throw new ArgeoException("Bad status format: " + status);
this.status = status;
}
@Override
public String toString() {
- return "ServerAnswer{status:"+status+", message:"+message+"}";
+ return "ServerAnswer{status:" + status + ", message:" + message + "}";
}
}
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.server.ArgeoServerException;
+import org.argeo.ArgeoException;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.BeansException;
in = res.getInputStream();
load(in, references);
} catch (Exception e) {
- throw new ArgeoServerException("Cannot load stream", e);
+ throw new ArgeoException("Cannot load stream", e);
} finally {
IOUtils.closeQuietly(in);
}
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.server.ArgeoServerException;
+import org.argeo.ArgeoException;
public abstract class AbstractTabularDaoSupport extends
AbstractMemoryDaoSupport {
}
if (clss == null)
- throw new ArgeoServerException("Cannot find a class for table "
+ throw new ArgeoException("Cannot find a class for table "
+ tableName);
return clss;
import java.beans.PropertyEditorSupport;
-import org.argeo.server.ArgeoServerException;
+import org.argeo.ArgeoException;
public class LightDaoPropertyEditor extends PropertyEditorSupport implements
LightDaoAware {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (targetClass == null)
- throw new ArgeoServerException("Target class cannot be null");
+ throw new ArgeoException("Target class cannot be null");
if (businessIdField != null)
setValue(lightDaoSupport.getByField(targetClass, businessIdField,
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.argeo.server.ArgeoServerException;
+import org.argeo.ArgeoException;
import org.argeo.server.ServerSerializer;
import org.springframework.web.servlet.view.AbstractView;
} else if (model.containsKey(viewName)) {
answer = model.get(viewName);
} else {
- throw new ArgeoServerException(
+ throw new ArgeoException(
"Model has a size different from 1. Specify a modelKey.");
}
</plugins>
</build>
<dependencies>
+ <dependency>
+ <groupId>org.argeo.commons.basic</groupId>
+ <artifactId>org.argeo.basic.nodeps</artifactId>
+ <version>0.1.2-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Jack Rabbit -->
<dependency>
<groupId>org.argeo.dep.osgi</groupId>
<artifactId>org.argeo.dep.osgi.jackrabbit</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>com.springsource.javax.servlet</artifactId>
+ </dependency>
<!-- Apache Commons -->
<dependency>
}
public Session login() throws LoginException, RepositoryException {
- return login();
+ return repository.login();
}
public Session login(Credentials credentials, String workspaceName)
throws LoginException, NoSuchWorkspaceException,
RepositoryException {
- return login(credentials, workspaceName);
+ return repository.login(credentials, workspaceName);
}
public Session login(Credentials credentials) throws LoginException,
RepositoryException {
- return login(credentials);
+ return repository.login(credentials);
}
public Session login(String workspaceName) throws LoginException,
NoSuchWorkspaceException, RepositoryException {
- return login(workspaceName);
+ return repository.login(workspaceName);
}
// BEANS METHODS
--- /dev/null
+package org.argeo.server.jackrabbit.webdav;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.jackrabbit.webdav.simple.ResourceConfig;
+import org.argeo.ArgeoException;
+import org.springframework.core.io.Resource;
+
+public class SimpleWebDavServlet extends
+ org.apache.jackrabbit.j2ee.SimpleWebdavServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ private Resource resourceConfiguration;
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+
+ if (resourceConfiguration != null) {
+ ResourceConfig resourceConfig = new ResourceConfig();
+ try {
+ resourceConfig.parse(resourceConfiguration.getURL());
+ } catch (IOException e) {
+ throw new ArgeoException("Cannot parse resource configuration "
+ + resourceConfiguration, e);
+ }
+ setResourceConfig(resourceConfig);
+ }
+ }
+
+ public void setResourceConfiguration(Resource resourceConfig) {
+ this.resourceConfiguration = resourceConfig;
+ }
+
+}