You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/03/20 07:36:22 UTC
[isis] 01/02: ISIS-2450: registers extracted out RestfulPathProvider
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 434760144f9d16ebd1560d1a9ffc780d49488a84
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Mar 20 07:12:30 2021 +0000
ISIS-2450: registers extracted out RestfulPathProvider
(cherry picked from commit f32c7213f2da2302614bfd6d7e9c889502b4a606)
---
.../isis/core/config/IsisModuleCoreConfig.java | 3 +-
.../isis/core/config/RestEasyConfiguration.java | 11 ------
.../core/config/applib/RestfulPathProvider.java | 46 ++++++++++++++++++++++
3 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/core/config/src/main/java/org/apache/isis/core/config/IsisModuleCoreConfig.java b/core/config/src/main/java/org/apache/isis/core/config/IsisModuleCoreConfig.java
index 477af11..6f6c96c 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/IsisModuleCoreConfig.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/IsisModuleCoreConfig.java
@@ -23,10 +23,10 @@ import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
+import org.apache.isis.core.config.applib.RestfulPathProvider;
import org.apache.isis.core.config.beans.IsisBeanFactoryPostProcessorForSpring;
import org.apache.isis.core.config.beans.IsisBeanTypeRegistryDefault;
import org.apache.isis.core.config.converters.PatternsConverter;
@@ -46,6 +46,7 @@ import org.apache.isis.core.config.viewer.wicket.WebAppContextPath;
IsisLocaleInitializer.class,
IsisTimeZoneInitializer.class,
PatternOptionalStringConstraintValidator.class,
+ RestfulPathProvider.class,
// @Service's
DataSourceIntrospectionService.class,
diff --git a/core/config/src/main/java/org/apache/isis/core/config/RestEasyConfiguration.java b/core/config/src/main/java/org/apache/isis/core/config/RestEasyConfiguration.java
index ae41e6e..32fcf93 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/RestEasyConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/RestEasyConfiguration.java
@@ -52,17 +52,6 @@ import lombok.Setter;
@Validated
public class RestEasyConfiguration {
- @Component
- @RequiredArgsConstructor(onConstructor_ = {@Inject})
- public static class RestfulPathProviderImpl implements Object_openRestApi.RestfulPathProvider {
-
- private final RestEasyConfiguration restEasyConfiguration;
- @Override
- public Optional<String> getRestfulPath() {
- return Optional.ofNullable(restEasyConfiguration.getJaxrs().getDefaultPath());
- }
- }
-
@Getter
private final Jaxrs jaxrs = new Jaxrs();
@Data
diff --git a/core/config/src/main/java/org/apache/isis/core/config/applib/RestfulPathProvider.java b/core/config/src/main/java/org/apache/isis/core/config/applib/RestfulPathProvider.java
new file mode 100644
index 0000000..9253d84
--- /dev/null
+++ b/core/config/src/main/java/org/apache/isis/core/config/applib/RestfulPathProvider.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.config.applib;
+
+import java.util.Optional;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.isis.applib.mixins.rest.Object_openRestApi;
+import org.apache.isis.core.config.RestEasyConfiguration;
+
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Exposes the path that the Restful Objects viewer's REST API has been
+ * configured for, to the {@link Object_openRestApi} mixin action.
+ */
+@Component
+@RequiredArgsConstructor(onConstructor_ = {@Inject})
+public class RestfulPathProvider implements Object_openRestApi.RestfulPathProvider {
+
+ private final RestEasyConfiguration restEasyConfiguration;
+
+ @Override
+ public Optional<String> getRestfulPath() {
+ return Optional.ofNullable(restEasyConfiguration.getJaxrs().getDefaultPath());
+ }
+}