[qpid-broker-j] branch 8.0.x updated: QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git The following commit(s) were added to refs/heads/8.0.x by this push: new 3e6ad50 QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter 3e6ad50 is described below commit 3e6ad50acdd8c49e034459ff1d352a88e0774cb8 Author: dakirily AuthorDate: Fri Jul 9 13:38:48 2021 +0200 QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter This closes #101 --- .../store/berkeleydb/CoalescingCommiter.java | 15 +++--- .../berkeleydb/StandardEnvironmentFacade.java | 18 +-- .../replication/ReplicatedEnvironmentFacade.java | 59 -- .../virtualhost/berkeleydb/BDBVirtualHost.java | 10 .../store/berkeleydb/CoalescingCommitterTest.java | 4 +- .../src/docbkx/Java-Broker-High-Availability.xml | 5 +- 6 files changed, 96 insertions(+), 15 deletions(-) diff --git a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java index 3dceae4..a4d082d 100644 --- a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java +++ b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java @@ -40,9 +40,9 @@ public class CoalescingCommiter implements Committer { private final CommitThread _commitThread; -public CoalescingCommiter(String name, EnvironmentFacade environmentFacade) +public CoalescingCommiter(String name, int commiterNotifyThreshold, long commiterWaitTimeout, EnvironmentFacade environmentFacade) { -_commitThread = new CommitThread("Commit-Thread-" + name, environmentFacade); +_commitThread = new CommitThread("Commit-Thread-" + name, commiterNotifyThreshold, commiterWaitTimeout, environmentFacade); } @Override @@ -134,8 +134,9 @@ public class CoalescingCommiter implements Committer private static class CommitThread extends Thread { private static final Logger LOGGER = LoggerFactory.getLogger(CommitThread.class); -private static final int JOB_QUEUE_NOTIFY_THRESHOLD = 8; +private final int _jobQueueNotifyThreshold; +private final long _commiterWaitTimeout; private final AtomicBoolean _stopped = new AtomicBoolean(false); private final Queue _jobQueue = new ConcurrentLinkedQueue<>(); private final Object _lock = new Object(); @@ -143,9 +144,11 @@ public class CoalescingCommiter implements Committer private final List _inProcessJobs = new ArrayList<>(256); -public CommitThread(String name, EnvironmentFacade environmentFacade) +public CommitThread(String name, int commiterNotifyThreshold, long commiterWaitTimeout, EnvironmentFacade environmentFacade) { super(name); +this._jobQueueNotifyThreshold = commiterNotifyThreshold; +this._commiterWaitTimeout = commiterWaitTimeout; _environmentFacade = environmentFacade; } @@ -170,7 +173,7 @@ public class CoalescingCommiter implements Committer { // Periodically wake up and check, just in case we // missed a notification. Don't want to lock the broker hard. -_lock.wait(500); +_lock.wait(_commiterWaitTimeout); } catch (InterruptedException e) { @@ -248,7 +251,7 @@ public class CoalescingCommiter implements Committer throw new IllegalStateException("Commit thread is stopped"); } _jobQueue.add(commit); -if(sync || _jobQueue.size() >= JOB_QUEUE_NOTIFY_THRESHOLD) +if(sync || _jobQueue.size() >= _jobQueueNotifyThreshold) { synchronized (_lock) { diff --git a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java index 3b55d24..59070a1 100644 --- a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java +++ b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java @@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicReference; import com.google.common.util.concurrent.ListenableFuture; + import com.sleepycat.je.CheckpointConfig; import com.sleepycat.je.Database; import com.sleepycat.je.DatabaseConfig; @@ -45,14 +46,15 @@ import com.sleepycat.je.Sequence; import com.sleepycat.je.SequenceConfig; import com.sleepycat.je.Transaction; import
[qpid-broker-j] branch main updated: QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git The following commit(s) were added to refs/heads/main by this push: new da4f6eb QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter da4f6eb is described below commit da4f6ebbdf05a51cb0117a9d50c375d42398835b Author: dakirily AuthorDate: Fri Jul 9 13:38:48 2021 +0200 QPID-8547: [Broker-J] Configurable parameters for CoalescingCommiter This closes #101 --- .../store/berkeleydb/CoalescingCommiter.java | 15 +++--- .../berkeleydb/StandardEnvironmentFacade.java | 18 +-- .../replication/ReplicatedEnvironmentFacade.java | 59 -- .../virtualhost/berkeleydb/BDBVirtualHost.java | 10 .../store/berkeleydb/CoalescingCommitterTest.java | 4 +- .../src/docbkx/Java-Broker-High-Availability.xml | 5 +- 6 files changed, 96 insertions(+), 15 deletions(-) diff --git a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java index 3dceae4..a4d082d 100644 --- a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java +++ b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java @@ -40,9 +40,9 @@ public class CoalescingCommiter implements Committer { private final CommitThread _commitThread; -public CoalescingCommiter(String name, EnvironmentFacade environmentFacade) +public CoalescingCommiter(String name, int commiterNotifyThreshold, long commiterWaitTimeout, EnvironmentFacade environmentFacade) { -_commitThread = new CommitThread("Commit-Thread-" + name, environmentFacade); +_commitThread = new CommitThread("Commit-Thread-" + name, commiterNotifyThreshold, commiterWaitTimeout, environmentFacade); } @Override @@ -134,8 +134,9 @@ public class CoalescingCommiter implements Committer private static class CommitThread extends Thread { private static final Logger LOGGER = LoggerFactory.getLogger(CommitThread.class); -private static final int JOB_QUEUE_NOTIFY_THRESHOLD = 8; +private final int _jobQueueNotifyThreshold; +private final long _commiterWaitTimeout; private final AtomicBoolean _stopped = new AtomicBoolean(false); private final Queue _jobQueue = new ConcurrentLinkedQueue<>(); private final Object _lock = new Object(); @@ -143,9 +144,11 @@ public class CoalescingCommiter implements Committer private final List _inProcessJobs = new ArrayList<>(256); -public CommitThread(String name, EnvironmentFacade environmentFacade) +public CommitThread(String name, int commiterNotifyThreshold, long commiterWaitTimeout, EnvironmentFacade environmentFacade) { super(name); +this._jobQueueNotifyThreshold = commiterNotifyThreshold; +this._commiterWaitTimeout = commiterWaitTimeout; _environmentFacade = environmentFacade; } @@ -170,7 +173,7 @@ public class CoalescingCommiter implements Committer { // Periodically wake up and check, just in case we // missed a notification. Don't want to lock the broker hard. -_lock.wait(500); +_lock.wait(_commiterWaitTimeout); } catch (InterruptedException e) { @@ -248,7 +251,7 @@ public class CoalescingCommiter implements Committer throw new IllegalStateException("Commit thread is stopped"); } _jobQueue.add(commit); -if(sync || _jobQueue.size() >= JOB_QUEUE_NOTIFY_THRESHOLD) +if(sync || _jobQueue.size() >= _jobQueueNotifyThreshold) { synchronized (_lock) { diff --git a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java index 3b55d24..59070a1 100644 --- a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java +++ b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java @@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicReference; import com.google.common.util.concurrent.ListenableFuture; + import com.sleepycat.je.CheckpointConfig; import com.sleepycat.je.Database; import com.sleepycat.je.DatabaseConfig; @@ -45,14 +46,15 @@ import com.sleepycat.je.Sequence; import com.sleepycat.je.SequenceConfig; import com.sleepycat.je.Transaction; import
[qpid-broker-j] branch 8.0.x updated: QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git The following commit(s) were added to refs/heads/8.0.x by this push: new 33a741b QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization 33a741b is described below commit 33a741bac7b510ba4a3326aaca4a868eaa990e3d Author: Alex Rudyy AuthorDate: Sun Jul 25 18:42:58 2021 +0100 QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization --- .../org/apache/qpid/server/virtualhost/AbstractVirtualHost.java| 6 ++ .../apache/qpid/server/virtualhost/QueueManagingVirtualHost.java | 7 +++ 2 files changed, 13 insertions(+) diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java index 7a6286b..0950909 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java +++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java @@ -1484,6 +1484,12 @@ public abstract class AbstractVirtualHost> exte } @Override +public long getInMemoryMessageThreshold() +{ +return getTargetSize(); +} + +@Override public > T getAttainedChildFromAddress(final Class childClass, final String address) { diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java index 2022aa4..48a9373 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java +++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java @@ -281,6 +281,13 @@ public interface QueueManagingVirtualHost> long getInMemoryMessageSize(); @SuppressWarnings("unused") +@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, +label = "In-Memory Message Bytes Threshold", +description="A threshold for triggering flow to disk when the size of all messages cached in-memory exceeds the value.", +metricName = "in_memory_message_threshold_bytes_total") +long getInMemoryMessageThreshold(); + +@SuppressWarnings("unused") @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Evacuated Message Bytes", description = "Total Number of Bytes Evacuated from Memory Due to Flow to Disk.") long getBytesEvacuatedFromMemory(); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-broker-j] branch main updated: QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git The following commit(s) were added to refs/heads/main by this push: new df0379f QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization df0379f is described below commit df0379f9dc61f021480e30a307f30ccde2182afd Author: Alex Rudyy AuthorDate: Sun Jul 25 18:42:58 2021 +0100 QPID-8556:[Broker-J] Expose virtual host threshold for triggering flow to disk on direct memory utilization --- .../org/apache/qpid/server/virtualhost/AbstractVirtualHost.java| 6 ++ .../apache/qpid/server/virtualhost/QueueManagingVirtualHost.java | 7 +++ 2 files changed, 13 insertions(+) diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java index c4c0ff5..ec0d776 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java +++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java @@ -1499,6 +1499,12 @@ public abstract class AbstractVirtualHost> exte } @Override +public long getInMemoryMessageThreshold() +{ +return getTargetSize(); +} + +@Override public > T getAttainedChildFromAddress(final Class childClass, final String address) { diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java index 4cd276a..690c076 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java +++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java @@ -276,6 +276,13 @@ public interface QueueManagingVirtualHost> long getInMemoryMessageSize(); @SuppressWarnings("unused") +@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, +label = "In-Memory Message Bytes Threshold", +description="A threshold for triggering flow to disk when the size of all messages cached in-memory exceeds the value.", +metricName = "in_memory_message_threshold_bytes_total") +long getInMemoryMessageThreshold(); + +@SuppressWarnings("unused") @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Evacuated Message Bytes", description = "Total Number of Bytes Evacuated from Memory Due to Flow to Disk.") long getBytesEvacuatedFromMemory(); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-broker-j] 02/02: QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git commit dc5bba197bc7327698b28500d6d1bfd546ced1df Author: Alex Rudyy AuthorDate: Sun Jul 25 17:06:14 2021 +0100 QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods --- .../java/org/apache/qpid/server/management/plugin/HttpManagement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index dcc58f1..080b7bd 100644 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -884,7 +884,7 @@ public class HttpManagement extends AbstractPluginAdapter implem @SuppressWarnings("unused") public static Set getAllAvailableCorsMethodCombinations() { -List methods = Arrays.asList("OPTION", "HEAD", "GET", "POST", "PUT", "DELETE"); +List methods = Arrays.asList("OPTIONS", "HEAD", "GET", "POST", "PUT", "DELETE"); Set> combinations = new HashSet<>(); int n = methods.size(); assert n < 31 : "Too many combination to calculate"; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-broker-j] branch main updated (53fa019 -> dc5bba1)
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git. from 53fa019 QPID-8161:[Broekr-J] Rethrow LockTimeoutException on sequence generation as ConnectionScopedRuntimeException new 69f8aaa QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method new dc5bba1 QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../server/management/plugin/HttpManagement.java | 6 +- .../plugin/filter/ForbiddingTraceFilter.java | 68 ...compressedJavascript.java => MethodFilter.java} | 43 +- .../management/plugin/filter/MethodFilterTest.java | 92 ++ 4 files changed, 117 insertions(+), 92 deletions(-) delete mode 100644 broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java copy broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/{RewriteRequestForUncompressedJavascript.java => MethodFilter.java} (57%) create mode 100644 broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/filter/MethodFilterTest.java - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-broker-j] 01/02: QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git commit 69f8aaa353bec0a57d7b4b149a9552831f35d3c7 Author: Alex Rudyy AuthorDate: Sun Jul 25 17:04:28 2021 +0100 QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method --- .../server/management/plugin/HttpManagement.java | 4 +- .../plugin/filter/ForbiddingTraceFilter.java | 68 .../management/plugin/filter/MethodFilter.java | 81 +++ .../management/plugin/filter/MethodFilterTest.java | 92 ++ 4 files changed, 175 insertions(+), 70 deletions(-) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 239d269..dcc58f1 100644 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -83,9 +83,9 @@ import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; import org.apache.qpid.server.logging.messages.PortMessages; import org.apache.qpid.server.management.plugin.filter.AuthenticationCheckFilter; import org.apache.qpid.server.management.plugin.filter.ExceptionHandlingFilter; -import org.apache.qpid.server.management.plugin.filter.ForbiddingTraceFilter; import org.apache.qpid.server.management.plugin.filter.InteractiveAuthenticationFilter; import org.apache.qpid.server.management.plugin.filter.LoggingFilter; +import org.apache.qpid.server.management.plugin.filter.MethodFilter; import org.apache.qpid.server.management.plugin.filter.RedirectFilter; import org.apache.qpid.server.management.plugin.filter.RewriteRequestForUncompressedJavascript; import org.apache.qpid.server.management.plugin.servlet.FileServlet; @@ -348,7 +348,7 @@ public class HttpManagement extends AbstractPluginAdapter implem corsFilter.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, String.valueOf(getCorsAllowCredentials())); root.addFilter(corsFilter, "/*", EnumSet.of(DispatcherType.REQUEST)); -root.addFilter(new FilterHolder(new ForbiddingTraceFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); +root.addFilter(new FilterHolder(new MethodFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); addFiltersAndServletsForRest(root); if (!Boolean.TRUE.equals(getContextValue(Boolean.class, DISABLE_UI_CONTEXT_NAME))) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java deleted file mode 100644 index c35b0df..000 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * 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.qpid.server.management.plugin.filter; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * This {@link Filter} blocks HTTP TRACE commands from being - * processed. All TRACE requests are sent a 403 error. - * - */ -public class ForbiddingTraceFilter implements Filter -{ -private static final String METHOD_TRACE = "TRACE"; - -@Override -public void destroy() -{ -} - -@Override -public void init(FilterConfig config) throws ServletException -{ -} - -@Override -public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, -
[qpid-broker-j] 02/02: QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git commit 3180b7ca1644abbd03f949f108d7b2001ef111b0 Author: Alex Rudyy AuthorDate: Sun Jul 25 17:06:14 2021 +0100 QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods --- .../java/org/apache/qpid/server/management/plugin/HttpManagement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 0703a1f..f87fe88 100644 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -884,7 +884,7 @@ public class HttpManagement extends AbstractPluginAdapter implem @SuppressWarnings("unused") public static Set getAllAvailableCorsMethodCombinations() { -List methods = Arrays.asList("OPTION", "HEAD", "GET", "POST", "PUT", "DELETE"); +List methods = Arrays.asList("OPTIONS", "HEAD", "GET", "POST", "PUT", "DELETE"); Set> combinations = new HashSet<>(); int n = methods.size(); assert n < 31 : "Too many combination to calculate"; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-broker-j] 01/02: QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git commit 8152ce7c723095b91137c4aedd8b9f8a83437d70 Author: Alex Rudyy AuthorDate: Sun Jul 25 17:04:28 2021 +0100 QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method --- .../server/management/plugin/HttpManagement.java | 4 +- .../plugin/filter/ForbiddingTraceFilter.java | 68 .../management/plugin/filter/MethodFilter.java | 81 +++ .../management/plugin/filter/MethodFilterTest.java | 92 ++ 4 files changed, 175 insertions(+), 70 deletions(-) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 374116e..0703a1f 100644 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -83,9 +83,9 @@ import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; import org.apache.qpid.server.logging.messages.PortMessages; import org.apache.qpid.server.management.plugin.filter.AuthenticationCheckFilter; import org.apache.qpid.server.management.plugin.filter.ExceptionHandlingFilter; -import org.apache.qpid.server.management.plugin.filter.ForbiddingTraceFilter; import org.apache.qpid.server.management.plugin.filter.InteractiveAuthenticationFilter; import org.apache.qpid.server.management.plugin.filter.LoggingFilter; +import org.apache.qpid.server.management.plugin.filter.MethodFilter; import org.apache.qpid.server.management.plugin.filter.RedirectFilter; import org.apache.qpid.server.management.plugin.filter.RewriteRequestForUncompressedJavascript; import org.apache.qpid.server.management.plugin.servlet.FileServlet; @@ -348,7 +348,7 @@ public class HttpManagement extends AbstractPluginAdapter implem corsFilter.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, String.valueOf(getCorsAllowCredentials())); root.addFilter(corsFilter, "/*", EnumSet.of(DispatcherType.REQUEST)); -root.addFilter(new FilterHolder(new ForbiddingTraceFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); +root.addFilter(new FilterHolder(new MethodFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); addFiltersAndServletsForRest(root); if (!Boolean.TRUE.equals(getContextValue(Boolean.class, DISABLE_UI_CONTEXT_NAME))) diff --git a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java b/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java deleted file mode 100644 index c35b0df..000 --- a/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * 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.qpid.server.management.plugin.filter; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * This {@link Filter} blocks HTTP TRACE commands from being - * processed. All TRACE requests are sent a 403 error. - * - */ -public class ForbiddingTraceFilter implements Filter -{ -private static final String METHOD_TRACE = "TRACE"; - -@Override -public void destroy() -{ -} - -@Override -public void init(FilterConfig config) throws ServletException -{ -} - -@Override -public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, -
[qpid-broker-j] branch 8.0.x updated (3b58792 -> 3180b7c)
This is an automated email from the ASF dual-hosted git repository. orudyy pushed a change to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git. from 3b58792 QPID-8161:[Broekr-J] Rethrow LockTimeoutException on sequence generation as ConnectionScopedRuntimeException new 8152ce7 QPID-8552: [Broker-J] Respond with forbidden error when request is made using unsupported method new 3180b7c QPID-8555: [Broker-J] Allow method OPTIONS in HTTP management attribute for setting CORS allowed methods The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../server/management/plugin/HttpManagement.java | 6 +- .../plugin/filter/ForbiddingTraceFilter.java | 68 ...compressedJavascript.java => MethodFilter.java} | 43 +- .../management/plugin/filter/MethodFilterTest.java | 92 ++ 4 files changed, 117 insertions(+), 92 deletions(-) delete mode 100644 broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java copy broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/{RewriteRequestForUncompressedJavascript.java => MethodFilter.java} (57%) create mode 100644 broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/filter/MethodFilterTest.java - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org