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 2020/01/10 12:56:53 UTC
[isis] 07/22: Merge remote-tracking branch 'origin/master' into ide
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2259
in repository https://gitbox.apache.org/repos/asf/isis.git
commit b89cf95c41b6dbacfbc0aa334d0549867c3f7d5a
Merge: aeef432 437eea4
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 10 12:24:59 2020 +0000
Merge remote-tracking branch 'origin/master' into ide
core/config/pom.xml | 18 ++++------
.../org/apache/isis/webapp/modules/WebModule.java | 13 ++++----
.../isis/webapp/modules/WebModuleContext.java | 31 +++++++----------
.../logonlog/WebModuleLogOnExceptionLogger.java | 2 +-
.../webappctx/IsisWebAppContextInitializer.java | 39 +++++++++++++++-------
.../cors/impl/webmodule/WebModuleCors.java | 2 +-
6 files changed, 53 insertions(+), 52 deletions(-)
diff --cc core/config/pom.xml
index 77abda1,cb81d62..effe5eb
--- a/core/config/pom.xml
+++ b/core/config/pom.xml
@@@ -63,11 -63,12 +63,16 @@@
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-applib</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-commons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate.validator</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ </dependency>
+
<!-- IDE support (optional) -->
<dependency>
<groupId>org.springframework.boot</groupId>
diff --cc extensions/vro/cors/impl/src/main/java/org/apache/isis/extensions/cors/impl/webmodule/WebModuleCors.java
index d9d47dc,0000000..6f35007
mode 100644,000000..100644
--- a/extensions/vro/cors/impl/src/main/java/org/apache/isis/extensions/cors/impl/webmodule/WebModuleCors.java
+++ b/extensions/vro/cors/impl/src/main/java/org/apache/isis/extensions/cors/impl/webmodule/WebModuleCors.java
@@@ -1,105 -1,0 +1,105 @@@
+/*
+ * 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.extensions.cors.impl.webmodule;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+
+import org.ebaysf.web.cors.CORSFilter;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.annotation.OrderPrecedence;
+import org.apache.isis.applib.services.inject.ServiceInjector;
+import org.apache.isis.webapp.modules.WebModuleAbstract;
+
+import lombok.Getter;
+
+/**
+ * WebModule providing support for CORS
+ *
+ * @since 2.0
+ */
+@Service
+@Named("isisMapCors.WebModuleServerCors")
+@Qualifier("CORS")
+@Order(OrderPrecedence.HIGH)
+public final class WebModuleCors extends WebModuleAbstract {
+
+ private final static String CORS_FILTER_NAME = "CORS Filter";
+
+ @Getter
+ private final String name = "CORS";
+
+ @Inject
+ public WebModuleCors(ServiceInjector serviceInjector) {
+ super(serviceInjector);
+ }
+
+
+
+ /*
+ <filter>
+ <filter-name>CORS Filter</filter-name>
+ <filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
+ <init-param>
+ <param-name>cors.allowed.origins</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.allowed.headers</param-name>
+ <param-value>Content-Type,Accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization,Cache-Control,If-Modified-Since,Pragma</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.exposed.headers</param-name>
+ <param-value>Authorization</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>CORS Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ */
+ @Override
+ public List<ServletContextListener> init(ServletContext ctx) throws ServletException {
+
+ registerFilter(ctx, CORS_FILTER_NAME, CORSFilter.class)
+ .ifPresent(filterReg -> {
+ filterReg.setInitParameter("cors.allowed.origins", "*");
+ filterReg.setInitParameter("cors.allowed.headers", "Content-Type,Accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization,Cache-Control,If-Modified-Since,Pragma");
+ filterReg.setInitParameter("cors.exposed.headers", "Authorization");
+
+ filterReg.addMappingForUrlPatterns(
+ null,
+ false,
- this.webModuleContext.getProtectedPaths());
++ this.webModuleContext.getProtectedPaths().toArray(String.class));
+
+ });
+
+ return null;
+ }
+
+
+}