- * If autoTx is true (which is the default) then a transaction will be started each time a path matching the
- * given path specification is requested. (the transaction is started in a filter before the JAX-RS resource is called
- * and closed after the response is sent to the output stream). If false then no transaction handling is done. The
- * default is to start a transaction for any path but: [^/]+/skin/.*
- *
- * The value attribute is required and must be used to specify the path pattern. The path pattern is either a
- * prefix or a regular expression. If the regex parameter is true (the default is false) then the value will be
- * expected to be a regular expression. A prefix denotes a path starting with 'prefix'. Paths are relative to the
- * webengine servlet (i.e. they correspond to the servlet path info in the JAX-RS servlet) - and always begin with a
- * '/'.
+ * Obsolete since 8.4, transactions are always active.
*/
@XObject("path")
-public class PathDescriptor implements Comparable {
-
- @XNode("@value")
- protected String value;
-
- @XNode("@regex")
- protected boolean regex = false;
-
- @XNode("@autoTx")
- protected Boolean autoTx;
-
- protected PathMatcher matcher;
-
- public PathDescriptor() {
- }
-
- public PathMatcher getMatcher() {
- return matcher;
- }
-
- public String getValue() {
- return value;
- }
-
- public Boolean getAutoTx() {
- return autoTx;
- }
-
- public boolean isAutoTx(boolean defaultValue) {
- return autoTx == null ? defaultValue : autoTx.booleanValue();
- }
-
- public PathMatcher createMatcher() {
- if (value != null) {
- if (!value.startsWith("/")) {
- value = "/" + value;
- }
- matcher = regex ? PathMatcher.getRegexMatcher(value) : PathMatcher.getPrefixMatcher(value);
- } else {
- throw new IllegalArgumentException("Path value is required");
- }
- return matcher;
- }
-
- public boolean match(String path) {
- return matcher.match(path);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof PathDescriptor) {
- PathDescriptor pd = ((PathDescriptor) obj);
- return value != null && value.equals(pd.value) || value == pd.value;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return value.hashCode();
- }
-
- @Override
- public String toString() {
- return value + "; autoTx: " + autoTx;
- }
-
- @Override
- public int compareTo(PathDescriptor o) {
- if (regex != o.regex) {
- return regex ? 1 : -1;
- }
- int len1 = value.length();
- int len2 = o.value.length();
- if (len1 == len2) {
- return value.compareTo(o.value);
- }
- return len2 - len1;
- }
+public class PathDescriptor {
}
diff --git a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/RequestConfiguration.java b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/RequestConfiguration.java
deleted file mode 100644
index d25b33b89283..000000000000
--- a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/RequestConfiguration.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others.
- *
- * 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.
- *
- * Contributors:
- * bstefanescu
- */
-package org.nuxeo.ecm.webengine;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author Bogdan Stefanescu
- */
-public class RequestConfiguration {
-
- /**
- * Synchronized list of configured paths
- */
- protected Set paths;
-
- /**
- * Thread safe cache
- */
- protected volatile PathDescriptor[] cache;
-
- public RequestConfiguration() {
- paths = Collections.synchronizedSet(new HashSet());
- }
-
- public void addPathDescriptor(PathDescriptor path) {
- path.createMatcher();
- paths.add(path);
- cache = null;
- }
-
- public void removePathDescriptor(PathDescriptor path) {
- paths.remove(path);
- cache = null;
- }
-
- public PathDescriptor[] getPaths() {
- PathDescriptor[] result = cache;
- if (result == null) {
- result = paths.toArray(new PathDescriptor[paths.size()]);
- Arrays.sort(result);
- cache = result;
- }
- return result;
- }
-
- public PathDescriptor getMatchingConfiguration(HttpServletRequest req) {
- String pathInfo = req.getPathInfo();
- if (pathInfo == null || pathInfo.length() == 0) {
- pathInfo = "/";
- }
- for (PathDescriptor pd : getPaths()) {
- if (pd.match(pathInfo)) {
- return pd;
- }
- }
- return null;
- }
-
-}
diff --git a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngine.java b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngine.java
index a4abbeb864db..12f53afe0d92 100644
--- a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngine.java
+++ b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngine.java
@@ -120,8 +120,6 @@ public static WebContext getActiveContext() {
protected final WebLoader webLoader;
- protected RequestConfiguration requestConfig;
-
protected volatile boolean isDirty;
public WebEngine(File root) {
@@ -152,13 +150,6 @@ public WebEngine(ResourceRegistry registry, File root) {
rendering = new FreemarkerEngine();
rendering.setResourceLocator(this);
rendering.setSharedVariable("env", getEnvironment());
-
- requestConfig = new RequestConfiguration();
-
- }
-
- public RequestConfiguration getRequestConfiguration() {
- return requestConfig;
}
/**
diff --git a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngineComponent.java b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngineComponent.java
index 6d6a785de296..262e68ba33c6 100644
--- a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngineComponent.java
+++ b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/WebEngineComponent.java
@@ -120,8 +120,7 @@ public void registerContribution(Object contribution, String extensionPoint, Com
// Form form = (Form)contribution;
// engine.getFormManager().registerForm(form);
} else if (extensionPoint.equals(REQUEST_CONFIGURATION_XP)) {
- PathDescriptor pd = (PathDescriptor) contribution;
- engine.getRequestConfiguration().addPathDescriptor(pd);
+ log.warn("Extension point " + REQUEST_CONFIGURATION_XP + " is obsolete since 8.4, transactions are always active");
}
}
@@ -139,9 +138,6 @@ public void unregisterContribution(Object contribution, String extensionPoint, C
// } else if (extensionPoint.endsWith(FORM_XP)) {
// Form form = (Form)contribution;
// engine.getFormManager().unregisterForm(form.getId());
- } else if (extensionPoint.equals(REQUEST_CONFIGURATION_XP)) {
- PathDescriptor pd = (PathDescriptor) contribution;
- engine.getRequestConfiguration().removePathDescriptor(pd);
}
}
diff --git a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/app/WebEngineFilter.java b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/app/WebEngineFilter.java
index a784e005a3a1..bc5969094632 100644
--- a/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/app/WebEngineFilter.java
+++ b/nuxeo-webengine/nuxeo-webengine-core/src/main/java/org/nuxeo/ecm/webengine/app/WebEngineFilter.java
@@ -35,7 +35,6 @@
import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.platform.web.common.ServletHelper;
import org.nuxeo.ecm.platform.web.common.requestcontroller.filter.BufferingHttpServletResponse;
-import org.nuxeo.ecm.webengine.PathDescriptor;
import org.nuxeo.ecm.webengine.WebEngine;
import org.nuxeo.ecm.webengine.model.WebContext;
import org.nuxeo.ecm.webengine.model.impl.AbstractWebContext;
@@ -82,8 +81,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
if (request instanceof HttpServletRequest) {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
- PathDescriptor pd = engine.getRequestConfiguration().getMatchingConfiguration(req);
- Config config = new Config(req, pd);
+ Config config = new Config(req);
AbstractWebContext ctx = initRequest(config, req, resp);
if (config.txStarted) {
resp = new BufferingHttpServletResponse(resp);
@@ -159,7 +157,7 @@ public void cleanup(Config config, AbstractWebContext ctx, HttpServletRequest re
}
public void initTx(Config config, HttpServletRequest req) {
- if (!config.isStatic && config.autoTx && !TransactionHelper.isTransactionActive()) {
+ if (!config.isStatic && !TransactionHelper.isTransactionActive()) {
config.txStarted = ServletHelper.startTransaction(req);
}
}
@@ -171,18 +169,14 @@ public void closeTx(Config config, HttpServletRequest req) {
}
protected static class Config {
- boolean autoTx;
boolean txStarted;
- boolean locked;
-
boolean isStatic;
String pathInfo;
- public Config(HttpServletRequest req, PathDescriptor pd) {
- autoTx = pd == null ? true : pd.isAutoTx(true);
+ public Config(HttpServletRequest req) {
pathInfo = req.getPathInfo();
if (pathInfo == null || pathInfo.length() == 0) {
pathInfo = "/";
@@ -197,8 +191,6 @@ public String toString() {
sb.append("WebEngineFilter&Confi:");
sb.append("\nPath Info:");
sb.append(pathInfo);
- sb.append("\nAuto TX:");
- sb.append(autoTx);
sb.append("\nStatic:");
sb.append(isStatic);
return sb.toString();
diff --git a/nuxeo-webengine/nuxeo-webengine-core/src/main/resources/OSGI-INF/webengine-framework.xml b/nuxeo-webengine/nuxeo-webengine-core/src/main/resources/OSGI-INF/webengine-framework.xml
index e2a3deabef19..ea7143d62e67 100644
--- a/nuxeo-webengine/nuxeo-webengine-core/src/main/resources/OSGI-INF/webengine-framework.xml
+++ b/nuxeo-webengine/nuxeo-webengine-core/src/main/resources/OSGI-INF/webengine-framework.xml
@@ -60,28 +60,8 @@
- @author Bogdan Stefanescu (bs@nuxeo.com)
- Configure how a given path is handled by the WebEngine filter.
-
- If autoTx is true (which is the default) then a transaction will be
- started each time a path matching the given path specification is requested.
- (the transaction is started in a filter before the JAX-RS resource is called
- and closed after the response is sent to the output stream). If false then no
- transaction handling is done. The default is to start a transaction for any
- path but: [^/]+/skin/.*
-
- The value attribute is required and must be used to specify the path pattern. The path
- pattern is either a prefix or a regular expression. If the regex parameter
- is true (the default is false) then the value will be expected to be a
- regular expression. A prefix denotes a path starting with 'prefix'. Paths are
- relative to the webengine servlet (i.e. they correspond to the servlet path
- info in the JAX-RS servlet) - and always begin with a '/'.
-
-
-
-
+ Obsolete since 8.4, transactions are always active.
-