From edbadd930b12b01b1a23fd2934dd021f46233be1 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Wed, 26 Apr 2006 15:14:52 +0000 Subject: [PATCH] added a tag to display a JMS message body git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@397217 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/web/MessageFacade.java | 43 +++++++++++++++++++ .../src/main/webapp/WEB-INF/tags/jms/body.tag | 17 ++++++++ 2 files changed, 60 insertions(+) create mode 100644 activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java create mode 100644 activemq-web-console/src/main/webapp/WEB-INF/tags/jms/body.tag diff --git a/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java b/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java new file mode 100644 index 0000000000..9e923c2860 --- /dev/null +++ b/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * 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.apache.activemq.web; + +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQMessage; + +import javax.jms.Message; + +/** + * + * @version $Revision$ + */ +public class MessageFacade extends BrokerFacade { + + private String id; + private ActiveMQMessage message; + + public MessageFacade(BrokerService brokerService) { + super(brokerService); + } + + public ActiveMQMessage getMessage() { + if (message != null) { + // TODO ?? + } + return message; + } +} diff --git a/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/body.tag b/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/body.tag new file mode 100644 index 0000000000..f6e8874ba5 --- /dev/null +++ b/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/body.tag @@ -0,0 +1,17 @@ +<%@ attribute name="message" type="javax.jms.Message" required="true" %> +<%@ attribute name="var" type="java.lang.String" required="true" %> +<%@ tag import="javax.jms.TextMessage" %> +<%@ tag import="javax.jms.ObjectMessage" %> +<% + Object value = null; + if (message != null) { + if (message instanceof TextMessage) { + value = ((TextMessage) message).getText(); + } + else if (message instanceof ObjectMessage) { + value = ((ObjectMessage) message).getObject(); + } + } + request.setAttribute(var, value); + System.out.println("var: " + var + " is now: " + value); +%>