From 0918fba384080081df16c327c52ff5382ae8ebfa Mon Sep 17 00:00:00 2001 From: "Adrian T. Co" Date: Thu, 9 Nov 2006 20:12:29 +0000 Subject: [PATCH] https://issues.apache.org/activemq/browse/AMQ-1036 - Fix some browsing problems in the web console. - Added a purge queue action. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@473056 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/controller/PurgeDestination.java | 59 +++++++++++++++++++ .../webapp/WEB-INF/dispatcher-servlet.xml | 1 + .../src/main/webapp/queues.jsp | 8 +-- .../src/main/webapp/xml/queues.jsp | 6 +- 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 activemq-web-console/src/main/java/org/apache/activemq/web/controller/PurgeDestination.java diff --git a/activemq-web-console/src/main/java/org/apache/activemq/web/controller/PurgeDestination.java b/activemq-web-console/src/main/java/org/apache/activemq/web/controller/PurgeDestination.java new file mode 100644 index 0000000000..97e7aa0056 --- /dev/null +++ b/activemq-web-console/src/main/java/org/apache/activemq/web/controller/PurgeDestination.java @@ -0,0 +1,59 @@ +/** + * + * 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.activemq.web.controller; + +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.region.Queue; +import org.apache.activemq.web.DestinationFacade; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.Controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Set; +import java.util.Iterator; + +/** + * + * @version $Revision$ + */ +public class PurgeDestination extends DestinationFacade implements Controller { + + public PurgeDestination(BrokerService brokerService) { + super(brokerService); + } + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { + purgeDestination(); + return redirectToBrowseView(); + } + + public void purgeDestination() throws Exception { + if (isQueue()) { + Set destinations = getManagedBroker().getQueueRegion().getDestinations(createDestination()); + for (Iterator i=destinations.iterator(); i.hasNext();) { + Queue regionQueue = (Queue)i.next(); + regionQueue.purge(); + } + } + else { + throw new UnsupportedOperationException("Purge supported for queues only. Receieved JMSDestinationType=" + getJMSDestinationType()); + } + } +} + diff --git a/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml b/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml index a0976b955b..1a6296b0d1 100644 --- a/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml +++ b/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml @@ -31,6 +31,7 @@ +