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
This commit is contained in:
James Strachan 2006-04-26 15:14:52 +00:00
parent c0ac0b7718
commit edbadd930b
2 changed files with 60 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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);
%>