Fold spring-js + spring-js-tiles3 into spring-webflow

Issue: SWF-1693
This commit is contained in:
Rossen Stoyanchev
2017-01-06 11:28:03 -05:00
parent 4d59b21e49
commit 5b0df65be4
33 changed files with 123 additions and 865 deletions

1
.gitignore vendored
View File

@@ -26,5 +26,4 @@ out
gradle-app.setting
spring-binding/src/main/java/META-INF/
spring-faces/src/main/java/META-INF/
spring-js/src/main/java/META-INF/
spring-webflow/src/main/java/META-INF/

View File

@@ -147,43 +147,29 @@ project("spring-binding") {
}
}
project("spring-js") {
description = "Spring JS"
project("spring-webflow") {
description = "Spring Web Flow"
dependencies {
compile(project(":spring-binding"))
compile("commons-logging:commons-logging:1.1.1")
compile("opensymphony:ognl:2.6.11")
compile("org.springframework:spring-beans:$springVersion")
compile("org.springframework:spring-context:$springVersion")
compile("org.springframework:spring-core:$springVersion")
compile("org.springframework:spring-expression:$springVersion")
compile("org.springframework:spring-web:$springVersion")
compile("org.springframework:spring-webmvc:$springVersion")
provided("javax.el:javax.el-api:2.2.5")
provided("javax.servlet:javax.servlet-api:3.0.1")
testCompile("javax.servlet:jstl:1.2") {
exclude group: "org.slf4j", module: "jcl-over-slf4j"
provided("junit:junit:3.8.2")
optional("org.hibernate:hibernate-core:$hibernate5Version") {
exclude group: "org.slf4j", module: "slf4j-api"
}
testCompile("log4j:log4j:$log4jVersion") {
exclude group: "javax.mail", module: "mail"
exclude group: "javax.jms", module: "jms"
exclude group: "com.sun.jdmk", module: "jmxtools"
exclude group: "com.sun.jmx", module: "jmxri"
}
testCompile("org.slf4j:jcl-over-slf4j:$slf4jVersion")
testCompile("org.slf4j:slf4j-api:$slf4jVersion")
testCompile("org.springframework:spring-test:$springVersion")
}
}
project("spring-js-tiles3") {
description = "Spring JS Tiles 3 Integration"
merge.into = project(":spring-js")
dependencies {
compile("commons-logging:commons-logging:1.1.1")
compile("org.springframework:spring-core:$springVersion")
compile("org.springframework:spring-webmvc:$springVersion")
optional("javax.el:javax.el-api:2.2.5")
optional("javax.servlet:javax.servlet-api:3.0.1")
optional("javax.servlet.jsp:javax.servlet.jsp-api:2.2.1")
optional("org.slf4j:slf4j-api:$slf4jVersion")
optional("org.springframework.security:spring-security-core:$springSecurityVersion")
optional("org.springframework:spring-orm:$springVersion")
optional("org.springframework:spring-tx:$springVersion")
optional("org.apache.tiles:tiles-request-api:1.0.1")
optional("org.apache.tiles:tiles-api:$tiles3Version")
optional("org.apache.tiles:tiles-core:$tiles3Version") {
@@ -203,37 +189,6 @@ project("spring-js-tiles3") {
exclude group: "org.springframework", module: "spring-web"
exclude group: "ognl", module: "ognl"
}
testCompile("javax.servlet:jstl:1.2")
testCompile("org.slf4j:jcl-over-slf4j:$slf4jVersion")
testCompile("org.slf4j:slf4j-api:$slf4jVersion")
testCompile("org.springframework:spring-test:$springVersion")
}
}
project("spring-webflow") {
description = "Spring Web Flow"
dependencies {
compile(project(":spring-binding"))
compile(project(":spring-js"))
compile("commons-logging:commons-logging:1.1.1")
compile("opensymphony:ognl:2.6.11")
compile("org.springframework:spring-beans:$springVersion")
compile("org.springframework:spring-context:$springVersion")
compile("org.springframework:spring-core:$springVersion")
compile("org.springframework:spring-expression:$springVersion")
compile("org.springframework:spring-web:$springVersion")
compile("org.springframework:spring-webmvc:$springVersion")
provided("javax.el:javax.el-api:2.2.5")
provided("javax.servlet:javax.servlet-api:3.0.1")
provided("junit:junit:3.8.2")
optional("org.hibernate:hibernate-core:$hibernate5Version") {
exclude group: "org.slf4j", module: "slf4j-api"
}
optional("org.slf4j:slf4j-api:$slf4jVersion")
optional("org.springframework.security:spring-security-core:$springSecurityVersion")
optional("org.springframework:spring-orm:$springVersion")
optional("org.springframework:spring-tx:$springVersion")
testCompile("javax.validation:validation-api:1.0.0.GA")
testCompile("org.hibernate:hibernate-entitymanager:$hibernate5Version") {
exclude group: "org.slf4j", module: "slf4j-api"
@@ -244,6 +199,15 @@ project("spring-webflow") {
testCompile("org.springframework:spring-aop:$springVersion")
testCompile("org.springframework:spring-jdbc:$springVersion")
testCompile("org.springframework:spring-test:$springVersion")
testCompile("javax.servlet.jsp:javax.servlet.jsp-api:2.2.1")
testCompile("javax.servlet:jstl:1.2")
testCompile("log4j:log4j:$log4jVersion") {
exclude group: "javax.mail", module: "mail"
exclude group: "javax.jms", module: "jms"
exclude group: "com.sun.jdmk", module: "jmxtools"
exclude group: "com.sun.jmx", module: "jmxri"
}
testCompile("org.slf4j:jcl-over-slf4j:$slf4jVersion")
}
}

View File

@@ -2,8 +2,6 @@ rootProject.name = 'webflow'
include 'spring-binding'
include 'spring-faces'
include 'spring-js'
include 'spring-js-tiles3'
include 'spring-webflow'
// Exposes gradle buildSrc

View File

@@ -27,7 +27,7 @@ import javax.faces.render.RenderKitFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.js.ajax.AbstractAjaxHandler;
import org.springframework.webflow.context.servlet.AbstractAjaxHandler;
/**
* Ajax handler for JSF 2 requests that can identify JSF 2 Ajax requests and send redirect instructions back to the

View File

@@ -16,12 +16,10 @@
package org.springframework.faces.webflow;
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
import javax.faces.lifecycle.Lifecycle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.js.ajax.AjaxHandler;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.webflow.mvc.servlet.FlowHandlerAdapter;

View File

@@ -2,8 +2,8 @@ package org.springframework.faces.webflow;
import junit.framework.TestCase;
import org.springframework.js.ajax.AjaxHandler;
import org.springframework.js.ajax.SpringJavascriptAjaxHandler;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.webflow.context.ExternalContext;
@@ -31,7 +31,7 @@ public class JsfFlowHandlerAdapterTests extends TestCase {
}
public void testAjaxHandlerProvided() throws Exception {
AjaxHandler myAjaxHandler = new SpringJavascriptAjaxHandler();
AjaxHandler myAjaxHandler = new DefaultAjaxHandler();
this.handlerAdapter.setAjaxHandler(myAjaxHandler);
this.handlerAdapter.afterPropertiesSet();
assertTrue(myAjaxHandler == this.handlerAdapter.getAjaxHandler());

View File

@@ -1,21 +0,0 @@
/*
* Copyright 2014 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.
*/
/**
* The Ajax integration between Spring.js and the Tiles3 layout system.
*/
package org.springframework.js.ajax.tiles3;

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<logger name="org.springframework.beans">
<level value="warn" />
</logger>
<logger name="org.springframework.binding">
<level value="debug" />
</logger>
<logger name="org.springframework.jdbc">
<level value="warn" />
</logger>
<logger name="org.springframework.transaction">
<level value="warn" />
</logger>
<logger name="org.springframework.orm">
<level value="warn" />
</logger>
<logger name="org.springframework.web">
<level value="debug" />
</logger>
<logger name="org.springframework.webflow">
<level value="debug" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@@ -1,21 +0,0 @@
/*
* 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.
*/
/**
* Contains the server-side support for handling Spring.js Ajax requests.
*/
package org.springframework.js.ajax;

View File

@@ -1,423 +0,0 @@
/*
* 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.js.resource;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.zip.GZIPOutputStream;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.ClassUtils;
import org.springframework.util.PathMatcher;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HttpServletBean;
/**
* Special resource servlet for efficiently resolving and rendering static resources from within a JAR file.
*
* @author Jeremy Grelle
* @author Scott Andrews
*
* @deprecated Deprecated in favor of the new resource handling mechanism available in Spring 3.0.4. See the
* documentation on the custom mvc namespace, specifically the new resources element.
*/
public class ResourceServlet extends HttpServletBean {
private static final String HTTP_CONTENT_LENGTH_HEADER = "Content-Length";
private static final String HTTP_LAST_MODIFIED_HEADER = "Last-Modified";
private static final String HTTP_EXPIRES_HEADER = "Expires";
private static final String HTTP_CACHE_CONTROL_HEADER = "Cache-Control";
private static final Log log = LogFactory.getLog(ResourceServlet.class);
private final String protectedPath = "/?WEB-INF/.*";
private String jarPathPrefix = "META-INF";
private String springJsJarPathPrefix = "META-INF/web-resources";
private boolean gzipEnabled = true;
private Set<String> allowedResourcePaths = new HashSet<String>();
{
allowedResourcePaths.add("/**/*.css");
allowedResourcePaths.add("/**/*.gif");
allowedResourcePaths.add("/**/*.ico");
allowedResourcePaths.add("/**/*.jpeg");
allowedResourcePaths.add("/**/*.jpg");
allowedResourcePaths.add("/**/*.js");
allowedResourcePaths.add("/**/*.png");
allowedResourcePaths.add("META-INF/**/*.css");
allowedResourcePaths.add("META-INF/**/*.gif");
allowedResourcePaths.add("META-INF/**/*.ico");
allowedResourcePaths.add("META-INF/**/*.jpeg");
allowedResourcePaths.add("META-INF/**/*.jpg");
allowedResourcePaths.add("META-INF/**/*.js");
allowedResourcePaths.add("META-INF/**/*.png");
};
private Map<String, String> defaultMimeTypes = new HashMap<String, String>();
{
defaultMimeTypes.put(".css", "text/css");
defaultMimeTypes.put(".gif", "image/gif");
defaultMimeTypes.put(".ico", "image/vnd.microsoft.icon");
defaultMimeTypes.put(".jpeg", "image/jpeg");
defaultMimeTypes.put(".jpg", "image/jpeg");
defaultMimeTypes.put(".js", "text/javascript");
defaultMimeTypes.put(".png", "image/png");
}
private Set<String> compressedMimeTypes = new HashSet<String>();
{
compressedMimeTypes.add("text/*");
}
private int cacheTimeout = 31556926;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String rawResourcePath = request.getPathInfo();
if (log.isDebugEnabled()) {
log.debug("Attempting to GET resource: " + rawResourcePath);
}
URL[] resources = getRequestResourceURLs(request);
if (resources == null || resources.length == 0) {
if (log.isDebugEnabled()) {
log.debug("Resource not found: " + rawResourcePath);
}
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
prepareResponse(response, resources, rawResourcePath);
OutputStream out = selectOutputStream(request, response);
try {
for (URL resource : resources) {
URLConnection resourceConn = resource.openConnection();
InputStream in = resourceConn.getInputStream();
try {
byte[] buffer = new byte[1024];
int bytesRead = -1;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
} finally {
in.close();
}
}
} finally {
out.close();
}
}
private OutputStream selectOutputStream(HttpServletRequest request, HttpServletResponse response)
throws IOException {
String acceptEncoding = request.getHeader("Accept-Encoding");
String mimeType = response.getContentType();
if (gzipEnabled && StringUtils.hasText(acceptEncoding) && acceptEncoding.indexOf("gzip") > -1
&& matchesCompressedMimeTypes(mimeType)) {
log.debug("Enabling GZIP compression for the current response.");
return new GZIPResponseStream(response);
} else {
return response.getOutputStream();
}
}
private boolean matchesCompressedMimeTypes(String mimeType) {
PathMatcher pathMatcher = new AntPathMatcher();
for (String compressedMimeType : compressedMimeTypes) {
if (pathMatcher.match(compressedMimeType, mimeType)) {
return true;
}
}
return false;
}
private void prepareResponse(HttpServletResponse response, URL[] resources, String rawResourcePath)
throws IOException {
long lastModified = -1;
int contentLength = 0;
String mimeType = null;
for (URL resource : resources) {
URLConnection resourceConn = resource.openConnection();
if (resourceConn.getLastModified() > lastModified) {
lastModified = resourceConn.getLastModified();
}
String currentMimeType = getServletContext().getMimeType(resource.getPath());
if (currentMimeType == null) {
String extension = resource.getPath().substring(resource.getPath().lastIndexOf('.'));
currentMimeType = defaultMimeTypes.get(extension);
}
if (mimeType == null) {
mimeType = currentMimeType;
} else if (!mimeType.equals(currentMimeType)) {
throw new MalformedURLException("Combined resource path: " + rawResourcePath
+ " is invalid. All resources in a combined resource path must be of the same mime type.");
}
contentLength += resourceConn.getContentLength();
}
response.setContentType(mimeType);
response.setHeader(HTTP_CONTENT_LENGTH_HEADER, Long.toString(contentLength));
response.setDateHeader(HTTP_LAST_MODIFIED_HEADER, lastModified);
if (cacheTimeout > 0) {
configureCaching(response, cacheTimeout);
}
}
protected long getLastModified(HttpServletRequest request) {
if (log.isDebugEnabled()) {
log.debug("Checking last modified of resource: " + request.getPathInfo());
}
URL[] resources;
try {
resources = getRequestResourceURLs(request);
} catch (MalformedURLException e) {
return -1;
}
if (resources == null || resources.length == 0) {
return -1;
}
long lastModified = -1;
for (URL resource : resources) {
URLConnection resourceConn;
try {
resourceConn = resource.openConnection();
} catch (IOException e) {
return -1;
}
if (resourceConn.getLastModified() > lastModified) {
lastModified = resourceConn.getLastModified();
}
}
return lastModified;
}
private URL[] getRequestResourceURLs(HttpServletRequest request) throws MalformedURLException {
String rawResourcePath = request.getPathInfo();
String appendedPaths = request.getParameter("appended");
if (StringUtils.hasText(appendedPaths)) {
rawResourcePath = rawResourcePath + "," + appendedPaths;
}
String[] localResourcePaths = StringUtils.delimitedListToStringArray(rawResourcePath, ",");
URL[] resources = new URL[localResourcePaths.length];
for (int i = 0; i < localResourcePaths.length; i++) {
String localResourcePath = localResourcePaths[i];
if (!isAllowed(localResourcePath)) {
if (log.isWarnEnabled()) {
log.warn("An attempt to access a protected resource at " + localResourcePath + " was disallowed.");
}
return null;
}
URL resource = getServletContext().getResource(localResourcePath);
if (resource == null) {
resource = getJarResource(springJsJarPathPrefix, localResourcePath);
}
if (resource == null) {
resource = getJarResource(jarPathPrefix, localResourcePath);
}
if (resource == null) {
if (resources.length > 1) {
log.debug("Combined resource not found: " + localResourcePath);
}
return null;
} else {
resources[i] = resource;
}
}
return resources;
}
private URL getJarResource(String jarPrefix, String resourcePath) {
String jarResourcePath = jarPrefix + resourcePath;
if (!isAllowed(jarResourcePath)) {
if (log.isWarnEnabled()) {
log.warn("An attempt to access a protected resource at " + jarResourcePath + " was disallowed.");
}
return null;
}
if (jarResourcePath.startsWith("/")) {
jarResourcePath = jarResourcePath.substring(1);
}
if (log.isDebugEnabled()) {
log.debug("Searching classpath for resource: " + jarResourcePath);
}
return ClassUtils.getDefaultClassLoader().getResource(jarResourcePath);
}
private boolean isAllowed(String resourcePath) {
if (resourcePath.matches(protectedPath)) {
return false;
}
PathMatcher pathMatcher = new AntPathMatcher();
for (String pattern : allowedResourcePaths) {
if (pathMatcher.match(pattern, resourcePath)) {
return true;
}
}
return false;
}
/**
* Set HTTP headers to allow caching for the given number of seconds.
* @param seconds number of seconds into the future that the response should be cacheable for
*/
private void configureCaching(HttpServletResponse response, int seconds) {
// HTTP 1.0 header
response.setDateHeader(HTTP_EXPIRES_HEADER, System.currentTimeMillis() + seconds * 1000L);
// HTTP 1.1 header
response.setHeader(HTTP_CACHE_CONTROL_HEADER, "max-age=" + seconds);
}
private class GZIPResponseStream extends ServletOutputStream {
private ByteArrayOutputStream byteStream = null;
private GZIPOutputStream gzipStream = null;
private boolean closed = false;
private HttpServletResponse response = null;
private ServletOutputStream servletStream = null;
public GZIPResponseStream(HttpServletResponse response) throws IOException {
super();
closed = false;
this.response = response;
this.servletStream = response.getOutputStream();
byteStream = new ByteArrayOutputStream();
gzipStream = new GZIPOutputStream(byteStream);
}
public void close() throws IOException {
if (closed) {
throw new IOException("This output stream has already been closed");
}
gzipStream.finish();
byte[] bytes = byteStream.toByteArray();
response.setContentLength(bytes.length);
response.addHeader("Content-Encoding", "gzip");
servletStream.write(bytes);
servletStream.flush();
servletStream.close();
closed = true;
}
public void flush() throws IOException {
if (closed) {
throw new IOException("Cannot flush a closed output stream");
}
gzipStream.flush();
}
public void write(int b) throws IOException {
if (closed) {
throw new IOException("Cannot write to a closed output stream");
}
gzipStream.write((byte) b);
}
public void write(byte b[]) throws IOException {
write(b, 0, b.length);
}
public void write(byte b[], int off, int len) throws IOException {
if (closed) {
throw new IOException("Cannot write to a closed output stream");
}
gzipStream.write(b, off, len);
}
}
/**
* Set whether to apply gzip compression to resources if the requesting client supports it.
*/
public void setGzipEnabled(boolean gzipEnabled) {
this.gzipEnabled = gzipEnabled;
}
/**
* Set allowed resources as an comma separated String of URL patterns, e.g. "META-INF/** /*.js", The paths may be
* any Ant-style pattern parsable by AntPathMatcher.
*
* @see AntPathMatcher
*/
public void setAllowedResourcePaths(String allowedResourcePaths) {
this.allowedResourcePaths = new HashSet<String>(Arrays.asList(StringUtils.tokenizeToStringArray(
allowedResourcePaths, ",", true, true)));
}
/**
* Set comma separated MIME types that should have gzip compression applied. Typically, gzip compression is only
* useful for text based content. Ant-style patterns are supported, e.g. "text/*".
*
* @see AntPathMatcher
*/
public void setCompressedMimeTypes(String compressedMimeTypes) {
this.compressedMimeTypes = new HashSet<String>(Arrays.asList(StringUtils.tokenizeToStringArray(
compressedMimeTypes, ",", true, true)));
}
/**
* Set the default path prefix to apply to resources being served from jar files. Default is "META-INF".
*/
public void setJarPathPrefix(String jarPathPrefix) {
this.jarPathPrefix = jarPathPrefix;
}
/**
* Set the number of seconds resources should be cached by the client. Zero disables caching. Default is one year.
*/
public void setCacheTimeout(int cacheTimeout) {
this.cacheTimeout = cacheTimeout;
}
}

View File

@@ -1,21 +0,0 @@
/*
* 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.
*/
/**
* Contains the generic ResourceServlet for serving web resources such as Javascript and CSS.
*/
package org.springframework.js.resource;

View File

@@ -1,98 +0,0 @@
package org.springframework.js.resource;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletConfig;
import org.springframework.mock.web.MockServletContext;
@SuppressWarnings("deprecation")
public class ResourceServletTests extends TestCase {
ServletContext servletContext = new ResourceTestMockServletContext();
ServletConfig config = new MockServletConfig(servletContext);
MockHttpServletResponse response = new MockHttpServletResponse();
MockHttpServletRequest request = new MockHttpServletRequest();
String[] requestElements;
ResourceServlet servlet;
protected void setUp() throws Exception {
servlet = new ResourceServlet();
servlet.init(config);
}
public final void testExecute() throws Exception {
String requestPath = "/org/springframework/js/resource/TestResource1.js";
request.setPathInfo(requestPath);
servlet.doGet(request, response);
assertEquals(200, response.getStatus());
assertNull(response.getHeader("Content-Encoding"));
}
public final void testExecute_CombinedResources() throws Exception {
String requestPath = "/org/springframework/js/resource/TestResource1.js";
request.setPathInfo(requestPath);
Map<String, String> params = new HashMap<String, String>();
params.put("appended", "/org/springframework/js/resource/TestResource2.js");
request.setParameters(params);
servlet.doGet(request, response);
assertEquals(200, response.getStatus());
}
public final void testExecute_CompressedResponse() throws Exception {
String requestPath = "/org/springframework/js/resource/TestResource1.js";
request.setPathInfo(requestPath);
request.addHeader("Accept-Encoding", "gzip");
servlet.doGet(request, response);
assertEquals(200, response.getStatus());
assertEquals("gzip", response.getHeader("Content-Encoding"));
}
public final void testExecute_ResourceNotFound() throws Exception {
String requestPath = "/xxx/xxx.js";
request.setPathInfo(requestPath);
servlet.doGet(request, response);
assertEquals(404, response.getStatus());
}
public final void testExecute_ProtectedPath() throws Exception {
String requestPath = "/WEB-INF/web.xml";
request.setPathInfo(requestPath);
servlet.doGet(request, response);
assertEquals(404, response.getStatus());
}
public final void testExecute_DisallowedPath() throws Exception {
String requestPath = "/persistence.xml";
request.setPathInfo(requestPath);
servlet.doGet(request, response);
assertEquals(404, response.getStatus());
}
private class ResourceTestMockServletContext extends MockServletContext {
public String getMimeType(String filePath) {
return null;
}
}
}

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<logger name="org.springframework.beans">
<level value="warn" />
</logger>
<logger name="org.springframework.binding">
<level value="debug" />
</logger>
<logger name="org.springframework.jdbc">
<level value="warn" />
</logger>
<logger name="org.springframework.transaction">
<level value="warn" />
</logger>
<logger name="org.springframework.orm">
<level value="warn" />
</logger>
<logger name="org.springframework.web">
<level value="debug" />
</logger>
<logger name="org.springframework.webflow">
<level value="debug" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@@ -1,4 +1,4 @@
package org.springframework.js.ajax;
package org.springframework.webflow.context.servlet;
import java.io.IOException;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.js.ajax;
package org.springframework.webflow.context.servlet;
import java.io.IOException;
@@ -41,7 +41,7 @@ public interface AjaxHandler {
* @param request the current request
* @param response the current response
* @param targetUrl the target url to redirect to
* @param popup wheter the redirect should be sent from a new popup dialog window
* @param popup whether the redirect should be sent from a new popup dialog window
*/
void sendAjaxRedirect(String targetUrl, HttpServletRequest request, HttpServletResponse response,
boolean popup) throws IOException;

View File

@@ -13,73 +13,66 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.js.ajax;
import java.io.IOException;
package org.springframework.webflow.context.servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.util.StringUtils;
/**
* Ajax handler for Spring Javascript (Spring.js).
* Default {@link AjaxHandler} implementation.
*
* @see AbstractAjaxHandler
* <p>Detects Ajax requests through an "Accept" header with the value
* {@link #AJAX_ACCEPT_CONTENT_TYPE} or a request parameter with the name
* {@link #AJAX_SOURCE_PARAM}.
*
* @author Jeremy Grelle
* @author Keith Donald
* <p>Also for a redirect during an Ajax request it sets the response headers
* {@link #REDIRECT_URL_HEADER} and {@link #POPUP_VIEW_HEADER}. The latter is
* set if the redirect occurs on a view state with popup="true".
*
* @deprecated as of version 2.4 Spring.js is deprecated
* @author Rossen Stoyanchev
* @since 2.5
*/
public class SpringJavascriptAjaxHandler extends AbstractAjaxHandler {
public class DefaultAjaxHandler extends AbstractAjaxHandler {
/**
* The response header to be set on an Ajax redirect
*/
public static final String REDIRECT_URL_HEADER = "Spring-Redirect-URL";
/**
* The response header to be set on an redirect that should be issued from a popup window.
*/
public static final String POPUP_VIEW_HEADER = "Spring-Modal-View";
/**
* The accept header value that signifies an Ajax request.
*/
/** "Accept" header value that indicates an Ajax request. */
public static final String AJAX_ACCEPT_CONTENT_TYPE = "text/html;type=ajax";
/**
* Alternate request parameter to indicate an Ajax request for cases when control of the header is not available.
*/
/** Request parameter alternative that indicate an Ajax request. */
public static final String AJAX_SOURCE_PARAM = "ajaxSource";
/** Response header to be set on an Ajax redirect with the redirect location */
public static final String REDIRECT_URL_HEADER = "Spring-Redirect-URL";
/** Response header to be set on a redirect that should be issued from a popup window. */
public static final String POPUP_VIEW_HEADER = "Spring-Modal-View";
/**
* Create a SpringJavascriptAjaxHandler that is not part of a chain of AjaxHandler's.
* Create a DefaultAjaxHandler that is not part of a chain of AjaxHandler's.
*/
public SpringJavascriptAjaxHandler() {
public DefaultAjaxHandler() {
this(null);
}
/**
* Create a SpringJavascriptAjaxHandler as part of a chain of AjaxHandler's.
* Create a DefaultAjaxHandler as part of a chain of AjaxHandler's.
*/
public SpringJavascriptAjaxHandler(AbstractAjaxHandler delegate) {
public DefaultAjaxHandler(AbstractAjaxHandler delegate) {
super(delegate);
}
protected boolean isAjaxRequestInternal(HttpServletRequest request, HttpServletResponse response) {
String acceptHeader = request.getHeader("Accept");
String ajaxParam = request.getParameter(AJAX_SOURCE_PARAM);
if (AJAX_ACCEPT_CONTENT_TYPE.equals(acceptHeader) || StringUtils.hasText(ajaxParam)) {
return true;
} else {
return false;
}
String header = request.getHeader(HttpHeaders.ACCEPT);
String param = request.getParameter(AJAX_SOURCE_PARAM);
return AJAX_ACCEPT_CONTENT_TYPE.equals(header) || StringUtils.hasText(param);
}
protected void sendAjaxRedirectInternal(String targetUrl, HttpServletRequest request, HttpServletResponse response,
boolean popup) throws IOException {
protected void sendAjaxRedirectInternal(String targetUrl, HttpServletRequest request,
HttpServletResponse response, boolean popup) {
if (popup) {
response.setHeader(POPUP_VIEW_HEADER, "true");
}

View File

@@ -20,13 +20,12 @@ import javax.servlet.http.HttpServletRequest;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UrlPathHelper;
import org.springframework.webflow.core.collection.AttributeMap;
import org.springframework.webflow.mvc.servlet.FlowController;
/**
* A file name based {@link FlowUrlHandler} implementation that is an alternative to the standard
* {@link DefaultFlowUrlHandler}. Treats the filename of a request without the URL suffix and/or prefix as the flow id.
* Used by the {@link FlowController} implementation as a default implementation to preserve compatibility with existing
* Web Flow 2 applications.
* Used by the {@link org.springframework.webflow.mvc.servlet.FlowController} implementation as a default
* implementation to preserve compatibility with existing Web Flow 2 applications.
*
* <p>
* This implementation extracts the filename and removes the file extension from the request URL. The results will be

View File

@@ -25,7 +25,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.js.ajax.AjaxHandler;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.webflow.context.servlet.FilenameFlowUrlHandler;

View File

@@ -25,8 +25,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.http.HttpStatus;
import org.springframework.js.ajax.AjaxHandler;
import org.springframework.js.ajax.SpringJavascriptAjaxHandler;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
@@ -234,7 +234,7 @@ public class FlowHandlerAdapter extends WebContentGenerator implements HandlerAd
flowUrlHandler = new DefaultFlowUrlHandler();
}
if (ajaxHandler == null) {
ajaxHandler = new SpringJavascriptAjaxHandler();
ajaxHandler = new DefaultAjaxHandler();
}
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.js.ajax.tiles3;
package org.springframework.webflow.mvc.view;
import java.util.HashMap;
import java.util.HashSet;
@@ -33,8 +33,8 @@ import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.request.ApplicationContext;
import org.apache.tiles.request.Request;
import org.apache.tiles.request.servlet.ServletRequest;
import org.springframework.js.ajax.AjaxHandler;
import org.springframework.js.ajax.SpringJavascriptAjaxHandler;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.support.JstlUtils;
@@ -45,7 +45,7 @@ import org.springframework.web.servlet.view.tiles3.TilesView;
* Tiles 3 view implementation that is able to handle partial rendering for Spring
* Javascript Ajax requests.
*
* <p>This implementation uses the {@link SpringJavascriptAjaxHandler} by default
* <p>This implementation uses the {@link DefaultAjaxHandler} by default
* to determine whether the current request is an Ajax request. On an Ajax request,
* a "fragments" parameter will be extracted from the request in order to
* determine which attributes to render from the current tiles view.
@@ -53,11 +53,11 @@ import org.springframework.web.servlet.view.tiles3.TilesView;
* @author Rossen Stoyanchev
* @since 2.4
*/
public class AjaxTilesView extends TilesView {
public class AjaxTiles3View extends TilesView {
private static final String FRAGMENTS_PARAM = "fragments";
private AjaxHandler ajaxHandler = new SpringJavascriptAjaxHandler();
private AjaxHandler ajaxHandler = new DefaultAjaxHandler();
public AjaxHandler getAjaxHandler() {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.js.ajax;
package org.springframework.webflow.mvc.view;
import java.io.IOException;
import java.util.Locale;
@@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
/**
* View resolver that provides special view resolution for Spring Javascript Ajax requests.
@@ -54,7 +56,7 @@ public class AjaxUrlBasedViewResolver extends UrlBasedViewResolver {
private class AjaxRedirectView extends RedirectView implements View {
private AjaxHandler ajaxHandler = new SpringJavascriptAjaxHandler();
private AjaxHandler ajaxHandler = new DefaultAjaxHandler();
public AjaxRedirectView(String redirectUrl, boolean redirectContextRelative, boolean redirectHttp10Compatible) {
super(redirectUrl, redirectContextRelative, redirectHttp10Compatible);

View File

@@ -16,11 +16,10 @@
package org.springframework.webflow.mvc.view;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.js.ajax.tiles3.AjaxTilesView;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.execution.View;
@@ -29,17 +28,16 @@ import org.springframework.webflow.execution.View;
* Tiles view implementation that is able to handle partial rendering for Spring
* Javascript Ajax requests.
*
* <p>This implementation uses the {@link org.springframework.js.ajax.SpringJavascriptAjaxHandler}
* <p>This implementation uses the {@link DefaultAjaxHandler}
* by default to determine whether the current request is an Ajax request. On an
* Ajax request for an active flow execution, the fragments set by a {@code <render>}
* action will be respected, otherwise the parent
* {@link org.springframework.js.ajax.tiles2.AjaxTilesView}'s resolution algorithm
* action will be respected, otherwise the parent {@link AjaxTiles3View}'s resolution algorithm
* will be applied.
*
* @author Rossen Stoyanchev
* @since 2.4
*/
public class FlowAjaxTiles3View extends AjaxTilesView {
public class FlowAjaxTiles3View extends AjaxTiles3View {
protected String[] getRenderFragments(Map<String, Object> model, HttpServletRequest request,

View File

@@ -1,7 +1,6 @@
package org.springframework.js.ajax;
package org.springframework.webflow.context.servlet;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@@ -9,7 +9,8 @@ import javax.servlet.http.HttpServletResponse;
import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.springframework.js.ajax.SpringJavascriptAjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
@@ -165,9 +166,9 @@ public class FlowControllerTests extends TestCase {
ModelAndView mv = controller.handleRequest(request, response);
assertNull(mv);
assertEquals(null, response.getRedirectedUrl());
assertEquals("true", response.getHeader(SpringJavascriptAjaxHandler.POPUP_VIEW_HEADER));
assertEquals("true", response.getHeader(DefaultAjaxHandler.POPUP_VIEW_HEADER));
assertEquals("/springtravel/app/foo?execution=12345",
response.getHeader(SpringJavascriptAjaxHandler.REDIRECT_URL_HEADER));
response.getHeader(DefaultAjaxHandler.REDIRECT_URL_HEADER));
EasyMock.verify(new Object[] { executor });
}
@@ -189,9 +190,9 @@ public class FlowControllerTests extends TestCase {
ModelAndView mv = controller.handleRequest(request, response);
assertNull(mv);
assertEquals(null, response.getRedirectedUrl());
assertEquals(null, response.getHeader(SpringJavascriptAjaxHandler.POPUP_VIEW_HEADER));
assertEquals(null, response.getHeader(DefaultAjaxHandler.POPUP_VIEW_HEADER));
assertEquals("/springtravel/app/foo?execution=12345",
response.getHeader(SpringJavascriptAjaxHandler.REDIRECT_URL_HEADER));
response.getHeader(DefaultAjaxHandler.REDIRECT_URL_HEADER));
EasyMock.verify(new Object[] { executor });
}

View File

@@ -1,11 +1,9 @@
package org.springframework.js.ajax.tiles3;
package org.springframework.webflow.mvc.view;
import java.util.HashMap;
import java.util.Map;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.tiles.Attribute;
import org.apache.tiles.AttributeContext;
import org.apache.tiles.Definition;
@@ -16,8 +14,8 @@ import org.apache.tiles.request.ApplicationContext;
import org.apache.tiles.request.Request;
import org.apache.tiles.request.servlet.ServletRequest;
import org.apache.tiles.request.servlet.wildcard.WildcardServletApplicationContext;
import org.springframework.js.ajax.SpringJavascriptAjaxHandler;
import org.springframework.js.ajax.tiles3.AjaxTilesView;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
@@ -26,9 +24,9 @@ import org.springframework.web.servlet.support.RequestContext;
import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
public class AjaxTilesViewTests extends TestCase {
public class AjaxTiles3ViewTests extends TestCase {
private AjaxTilesView ajaxTilesView;
private AjaxTiles3View ajaxTilesView;
private MockHttpServletRequest request;
@@ -39,18 +37,18 @@ public class AjaxTilesViewTests extends TestCase {
protected void setUp() throws Exception {
servletContext = new MockServletContext("/org/springframework/js/ajax/tiles3/");
servletContext = new MockServletContext("/org/springframework/webflow/mvc/view/");
request = new MockHttpServletRequest(servletContext);
response = new MockHttpServletResponse();
TilesConfigurer tc = new TilesConfigurer();
tc.setDefinitions(new String[] { "tiles-definitions.xml" });
tc.setDefinitions("tiles-definitions.xml");
tc.setValidateDefinitions(true);
tc.setServletContext(servletContext);
tc.setUseMutableTilesContainer(false);
tc.afterPropertiesSet();
ajaxTilesView = new AjaxTilesView();
ajaxTilesView = new AjaxTiles3View();
}
private void setupStaticWebApplicationContext() {
@@ -65,46 +63,46 @@ public class AjaxTilesViewTests extends TestCase {
setupStaticWebApplicationContext();
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertEquals("/WEB-INF/layout.jsp", response.getForwardedUrl());
}
public void testAjaxRequestNoFragments() throws Exception {
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertEquals("/WEB-INF/layout.jsp", response.getForwardedUrl());
}
public void testRenderFragment_Template() throws Exception {
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addParameter("fragments", "searchResults");
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertEquals("/WEB-INF/searchResults.jsp", response.getForwardedUrl());
}
public void testRenderFragment_Definition() throws Exception {
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addParameter("fragments", "body");
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertEquals("/WEB-INF/search.jsp", response.getForwardedUrl());
}
public void testRenderFragment_CascadedAttribute() throws Exception {
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addParameter("fragments", "searchNavigation");
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertEquals("/WEB-INF/searchNavigation.jsp", response.getForwardedUrl());
}
@@ -115,11 +113,11 @@ public class AjaxTilesViewTests extends TestCase {
Definition definition = container.getDefinitionsFactory().getDefinition("search.body", tilesRequest);
definition.setPreparer(AttributeTestingPreparer.class.getName());
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addParameter("fragments", "body");
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertTrue(AttributeTestingPreparer.invoked);
}
@@ -138,11 +136,11 @@ public class AjaxTilesViewTests extends TestCase {
public void testRenderFragment_Multiple() throws Exception {
setupStaticWebApplicationContext();
request.addHeader("Accept", SpringJavascriptAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addHeader("Accept", DefaultAjaxHandler.AJAX_ACCEPT_CONTENT_TYPE);
request.addParameter("fragments", "body,searchNavigation");
ajaxTilesView.setUrl("search");
ajaxTilesView.afterPropertiesSet();
ajaxTilesView.renderMergedOutputModel(new HashMap<String, Object>(), request, response);
ajaxTilesView.renderMergedOutputModel(new HashMap<>(), request, response);
assertTrue("Multiple fragments should result in include, not forward", response.getIncludedUrls().size() == 2);
assertEquals("/WEB-INF/search.jsp", response.getIncludedUrls().get(0));
assertEquals("/WEB-INF/searchNavigation.jsp", response.getIncludedUrls().get(1));
@@ -162,7 +160,7 @@ public class AjaxTilesViewTests extends TestCase {
}
public void testGetRenderFragments() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
request.setParameter("fragments", "f1,f2, f3");
String[] fragments = ajaxTilesView.getRenderFragments(model, request, response);
assertEquals("f1", fragments[0]);
@@ -177,7 +175,7 @@ public class AjaxTilesViewTests extends TestCase {
public void execute(Request tilesContext, AttributeContext attributeContext) {
invoked = true;
Assert.assertTrue(attributeContext.getAttribute("searchNavigation") != null);
assertTrue(attributeContext.getAttribute("searchNavigation") != null);
}
}

22
src/dist/readme.txt vendored
View File

@@ -50,25 +50,19 @@ SpringSource repository. Add the following repository to your Maven pom.xml:
</repository>
Then declare the following dependencies (note that many times it's sufficient
to include spring-webflow only, which will give you spring-binding and spring-js
to include spring-webflow only, which will give you spring-binding
via transitive dependencies):
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>org.springframework.binding</artifactId>
<version>2.4.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>org.springframework.js</artifactId>
<version>2.4.4.RELEASE</version>
<version>x.y.z.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>org.springframework.webflow</artifactId>
<version>2.4.4.RELEASE</version>
<version>x.y.z.RELEASE</version>
</dependency>
If using JSF all you need to include is:
@@ -76,7 +70,7 @@ If using JSF all you need to include is:
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>org.springframework.faces</artifactId>
<version>2.4.4.RELEASE</version>
<version>x.y.z.RELEASE</version>
</dependency>
To access jars using Ivy, add the following repositories to your Ivy config:
@@ -93,13 +87,13 @@ To access jars using Ivy, add the following repositories to your Ivy config:
Then declare the following dependencies in your ivy.xml:
<dependency org="org.springframework.webflow" name="org.springframework.binding" rev="2.4.4.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.js" rev="2.4.4.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.webflow" rev="2.4.4.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.binding" rev="x.y.z.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.js" rev="x.y.z.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.webflow" rev="x.y.z.RELEASE" conf="compile->runtime" />
If using JavaServerFaces:
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="2.4.4.RELEASE" conf="compile->runtime" />
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="x.y.z.RELEASE" conf="compile->runtime" />
For more information see the reference documentation and the SpringSource Repository FAQ:
https://github.com/spring-projects/spring-framework/wiki/Spring-repository-FAQ

View File

@@ -49,7 +49,7 @@
</para>
<para>
To access Web Flow jars from Maven Central, declare the following dependency in your pom (includes
transitive dependencies "spring-binding" and "spring-js"):
transitive dependencies "spring-binding"):
</para>
<programlisting language="xml"><![CDATA[
<dependency>
@@ -60,7 +60,8 @@
]]>
</programlisting>
<para>
If using JavaServer Faces, declare the following dependency in your pom (includes transitive dependencies "spring-binding", "spring-webflow" and "spring-js"):
If using JavaServer Faces, declare the following dependency in your pom
(includes transitive dependencies "spring-binding", "spring-webflow"):
</para>
<programlisting language="xml"><![CDATA[
<dependency>
@@ -148,12 +149,6 @@
<version>x.y.z.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-js</artifactId>
<version>x.y.z.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>

View File

@@ -48,7 +48,7 @@
(note that these extensions require the use of Tiles for templating):
</para>
<programlisting language="xml"><![CDATA[
<bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver">
<bean id="tilesViewResolver" class="org.springframework.webflow.mvc.view.AjaxUrlBasedViewResolver">
<property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView"/>
</bean>]]>
</programlisting>