From cd695134619650c75b5262b8025c80802fcd8ffe Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 8 Feb 2018 23:05:13 -0800 Subject: [PATCH] Flow Resource Resolver Issue: SWF-1719 --- .../faces/webflow/FlowResourceHandler.java | 54 +++++++++++++++++++ .../main/resources/META-INF/faces-config.xml | 1 + 2 files changed, 55 insertions(+) create mode 100644 spring-faces/src/main/java/org/springframework/faces/webflow/FlowResourceHandler.java diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowResourceHandler.java b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowResourceHandler.java new file mode 100644 index 00000000..ae7fcc97 --- /dev/null +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowResourceHandler.java @@ -0,0 +1,54 @@ +/* + * Copyright 2004-2012 the original author or authors. + * + * Licensed 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.springframework.faces.webflow; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.faces.FacesException; +import javax.faces.application.ResourceHandler; +import javax.faces.application.ResourceHandlerWrapper; +import javax.faces.context.FacesContext; +import javax.faces.view.facelets.ResourceResolver; + +import org.springframework.context.ApplicationContext; +import org.springframework.core.io.Resource; +import org.springframework.util.ClassUtils; +import org.springframework.webflow.execution.RequestContext; +import org.springframework.webflow.execution.RequestContextHolder; + +/** + * Resolves Facelets resources using Spring Resource paths such as "classpath:foo.xhtml". + */ +public class FlowResourceHandler extends ResourceHandlerWrapper { + + private final ResourceHandler wrapped; + + public FlowResourceHandler(ResourceHandler delegate) { + this.wrapped = delegate; + } + + @Override + public ResourceHandler getWrapped() { + return this.wrapped; + } + + // FIXME will need to copy logic from FlowResourceResolver + +} diff --git a/spring-faces/src/main/resources/META-INF/faces-config.xml b/spring-faces/src/main/resources/META-INF/faces-config.xml index 386fb2d6..5a02dcb7 100644 --- a/spring-faces/src/main/resources/META-INF/faces-config.xml +++ b/spring-faces/src/main/resources/META-INF/faces-config.xml @@ -9,6 +9,7 @@ org.springframework.faces.webflow.FlowActionListener org.springframework.faces.model.SelectionTrackingActionListener org.springframework.faces.webflow.FlowELResolver + org.springframework.faces.webflow.FlowResourceHandler