Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 85d9ecc9 by Tony CHEMIT at 2017-09-10T10:15:43+02:00 La connexion à un serveur distant ne fonctionne plus (See #871) - - - - - 1 changed file: - services-client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java Changes: ===================================== services-client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java ===================================== --- a/services-client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java +++ b/services-client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java @@ -38,6 +38,7 @@ import fr.ird.observe.services.service.ObserveService; import io.ultreia.java4all.http.HResponseBuilder; import java.io.IOException; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Created on 16/08/15. @@ -61,6 +62,8 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im }); private final static ClassMappingClient CLASS_MAPPING = ClassMappingClient.get(); + private final static int LOCATE_PREFIX_LENGTH = ObserveServiceClientSupport.class.getPackage().getName().length(); + @Override public <S extends ObserveService> boolean accept(ObserveDataSourceConfiguration dataSourceConfiguration, Class<S> serviceType) { @@ -110,8 +113,8 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im throw new IllegalStateException("Can't get service " + implementationType, e); } - String serviceLocation = implementationType.getCanonicalName().replace(serviceType.getName(), ""); - serviceLocation = serviceLocation.substring(0, serviceLocation.length() - "Client".length()); + String serviceLocation = implementationType.getCanonicalName().substring(LOCATE_PREFIX_LENGTH).replaceAll("\\.", "/"); + serviceLocation = StringUtils.removeEnd(serviceLocation, "Client"); ObserveServiceClientContext serviceRestApiContext = new ObserveServiceClientContext( observeServiceInitializer, View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/85d9ecc9582ea6a62595354ad269... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/85d9ecc9582ea6a62595354ad269... You're receiving this email because of your account on gitlab.com.