</snapshots>
</repository>
+ <!--
<repository>
<id>codehaus repo</id>
<name>codehaus repo</name>
<enabled>false</enabled>
</snapshots>
</repository>
+ -->
<repository>
<id>nuxeo-public</id>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3.3</version>
+ </dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope; //import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
-
+import org.apache.http.impl.client.DefaultHttpClient;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.jaxb.AbstractCommonList;
-
import org.jboss.resteasy.client.ClientResponse; //import org.collectionspace.services.common.context.ServiceContext;
import org.jboss.resteasy.client.ProxyFactory;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
+import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor;
+//import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private URL url;
/** The http client. */
private HttpClient httpClient;
+ private org.apache.http.client.HttpClient httpClient4;
+
/** The RESTEasy proxy */
private P proxy;
protected AbstractServiceClientImpl() {
readProperties();
setupHttpClient();
+ setupHttpClient4(); // temp fix for CSPACE-6281
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(factory);
setProxy();
return httpClient;
}
+ public org.apache.http.client.HttpClient getHttpClient4() {
+ return httpClient4;
+ }
+
/*
* (non-Javadoc)
*
e.printStackTrace();
}
}
+
+ /*
+ * This is a temp fix for RESTEasy upgrade in CSPACE-6281. The long-term solution will be to use
+ * the non-deprecated approach per the RESTEasy documentation.
+ */
+ public void setupHttpClient4() {
+ try {
+ this.httpClient4 = new DefaultHttpClient();
+ if (useAuth()) {
+ String user = properties.getProperty(USER_PROPERTY);
+ String password = properties.getProperty(PASSWORD_PROPERTY);
+ if (logger.isDebugEnabled()) {
+ logger.debug("setupHttpClient() using url=" + url + " user="
+ + user + " password=" + password);
+ }
+
+ httpClient.getState().setCredentials(
+ new AuthScope(url.getHost(), url.getPort(),
+ AuthScope.ANY_REALM),
+ new UsernamePasswordCredentials(user, password));
+ // JAXRS client library requires HTTP preemptive authentication
+ httpClient.getParams().setAuthenticationPreemptive(true);
+ if (logger.isDebugEnabled()) {
+ logger.debug("setupHttpClient: set preemptive authentication");
+ }
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("setupHttpClient() : no auth mode!");
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
/*
* (non-Javadoc)
Class<P> proxyClass = this.getProxyClass();
if (useAuth()) {
proxy = ProxyFactory.create(proxyClass,
- getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
+ getBaseURL(), new ApacheHttpClient4Executor(getHttpClient4()));
} else {
proxy = ProxyFactory.create(proxyClass,
getBaseURL());
removeProperty(CollectionSpaceClient.AUTH_PROPERTY);
}
setupHttpClient();
+ setupHttpClient(); // temp fix for CSPACE-6281
setProxy();
}
import org.collectionspace.services.common.security.UnauthorizedException;
import org.collectionspace.services.common.storage.StorageClient;
import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl;
-import org.jboss.resteasy.core.ResourceMethod;
+//import org.jboss.resteasy.core.ResourceMethod;
import org.jboss.resteasy.spi.HttpRequest;
+import org.jboss.resteasy.spi.metadata.ResourceMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
package org.collectionspace.services.common;
+import java.lang.reflect.Method;
+
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.context.ServiceContextFactory;
import org.collectionspace.services.common.document.DocumentHandler;
import org.collectionspace.services.common.repository.RepositoryClient;
import org.collectionspace.services.common.storage.StorageClient;
-import org.jboss.resteasy.core.ResourceMethod;
+//import org.jboss.resteasy.core.ResourceMethod;
import org.jboss.resteasy.spi.HttpRequest;
+import org.jboss.resteasy.spi.metadata.ResourceMethod;
/**
* The Interface CollectionSpaceResource.
*/
// <sec:filter-chain pattern="/publicitems/*/*/content"
// filters="none"/>
- public boolean allowAnonymousAccess(HttpRequest request, ResourceMethod method);
+ public boolean allowAnonymousAccess(HttpRequest request, Method method);
}
package org.collectionspace.services.common.publicitem;
import java.io.InputStream;
+import java.lang.reflect.Method;
import org.collectionspace.authentication.spi.AuthNContext;
import org.collectionspace.services.publicitem.PublicitemsCommon;
import org.collectionspace.services.common.blob.BlobOutput;
import org.collectionspace.services.common.context.RemoteServiceContext;
import org.collectionspace.services.common.imaging.nuxeo.NuxeoBlobUtils;
-import org.jboss.resteasy.core.ResourceMethod;
+//import org.jboss.resteasy.core.ResourceMethod;
import org.jboss.resteasy.spi.HttpRequest;
-
+import org.jboss.resteasy.spi.metadata.ResourceMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
public boolean allowAnonymousAccess(HttpRequest request,
- ResourceMethod method) {
+ Method method) {
return true;
}
*/
package org.collectionspace.services.common.security;
+import java.lang.reflect.Method;
import java.security.Principal;
import java.util.HashMap;
import java.util.Set;
-import org.jboss.resteasy.core.ResourceMethod;
+//import org.jboss.resteasy.core.ResourceMethod;
+import org.jboss.resteasy.core.ResourceMethodInvoker;
import org.jboss.resteasy.core.ServerResponse;
import org.jboss.resteasy.spi.interception.PostProcessInterceptor;
import org.jboss.resteasy.spi.interception.PreProcessInterceptor;
import org.jboss.resteasy.annotations.interception.ServerInterceptor;
import org.jboss.resteasy.spi.Failure;
import org.jboss.resteasy.spi.HttpRequest;
-
import org.nuxeo.runtime.api.Framework;
import javax.security.auth.Subject;
import org.collectionspace.services.common.document.JaxbUtils;
import org.collectionspace.services.common.storage.jpa.JpaStorageUtils;
import org.collectionspace.services.common.security.SecurityUtils;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final String ERROR_NUXEO_LOGOUT = "Attempt to logout when Nuxeo login context was null";
private static final String ERROR_UNBALANCED_LOGINS = "The number of Logins vs Logouts to the Nuxeo framework was unbalanced.";
- private boolean isAnonymousRequest(HttpRequest request, ResourceMethod resourceMethod) {
+ private boolean isAnonymousRequest(HttpRequest request, Method resourceMethod) {
boolean result = false;
- Class<?> resourceClass = resourceMethod.getResourceClass();
+ Class<?> resourceClass = resourceMethod.getClass();
try {
CollectionSpaceResource resourceInstance = (CollectionSpaceResource)resourceClass.newInstance();
result = resourceInstance.allowAnonymousAccess(request, resourceMethod);
* @see org.jboss.resteasy.spi.interception.PreProcessInterceptor#preProcess(org.jboss.resteasy.spi.HttpRequest, org.jboss.resteasy.core.ResourceMethod)
*/
@Override
- public ServerResponse preProcess(HttpRequest request, ResourceMethod resourceMethod)
+ public ServerResponse preProcess(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker)
throws Failure, CSWebApplicationException {
ServerResponse result = null; // A null value essentially means success for this method
+ Method resourceMethod = resourceMethodInvoker.getMethod();
try {
if (isAnonymousRequest(request, resourceMethod) == true) {
//
// Nuxeo login support
//
- public ServerResponse nuxeoPreProcess(HttpRequest request, ResourceMethod resourceMethod)
+ public ServerResponse nuxeoPreProcess(HttpRequest request, Method resourceMethod)
throws Failure, CSWebApplicationException {
try {
nuxeoLogin();
<jaxb2-basics.version>0.6.2</jaxb2-basics.version>
<maven-jaxb2-plugin.version>0.12.3</maven-jaxb2-plugin.version>
<jaxb.version>2.2.4-1</jaxb.version>
+ <resteasy.version>3.0.9.Final</resteasy.version>
<mysql.driver.version>5.1.8</mysql.driver.version>
<postgres.driver.version>9.1-901.jdbc4</postgres.driver.version>
<!-- The default life cycle policy for Nuxeo document types -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
- <version>2.2.2.GA</version>
+ <version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>2.2.2.GA</version>
+ <version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>2.2.2.GA</version>
+ <version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>2.2.2.GA</version>
+ <version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>