Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 15464 invoked from network); 20 Jun 2006 22:27:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2006 22:27:11 -0000 Received: (qmail 7494 invoked by uid 500); 20 Jun 2006 22:27:11 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 7470 invoked by uid 500); 20 Jun 2006 22:27:11 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 7461 invoked by uid 99); 20 Jun 2006 22:27:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 15:27:11 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 15:27:10 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3B96F1A9842; Tue, 20 Jun 2006 15:26:50 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r415827 - in /incubator/activemq/trunk/activemq-web/src/main: java/org/apache/activemq/web/MessageListenerServlet.java resources/org/apache/activemq/web/_amq.js Date: Tue, 20 Jun 2006 22:26:49 -0000 To: activemq-commits@geronimo.apache.org From: gregw@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060620222650.3B96F1A9842@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gregw Date: Tue Jun 20 15:26:49 2006 New Revision: 415827 URL: http://svn.apache.org/viewvc?rev=415827&view=rev Log: changed parameter handling to impose a strict ordering to avoid reordering of messages by client libraries Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?rev=415827&r1=415826&r2=415827&view=diff ============================================================================== --- incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java (original) +++ incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java Tue Jun 20 15:26:49 2006 @@ -90,7 +90,16 @@ } /** - * Sends a message to a destination + * Sends a message to a destination or manage subscriptions. + * + * If the the content type of the POST is application/x-www-form-urlencoded, then the form parameters + * "destination", "message" and "type" are used to pass a message or a subscription. If multiple messages + * or subscriptions are passed in a single post, then additional parameters are shortened to "dN", "mN" and "tN" + * where N is an index starting from 1. The type is either "send", "listen" or "unlisten". For send types, + * the message is the text of the TextMessage, otherwise it is the ID to be used for the subscription. + * + * If the content type is not application/x-www-form-urlencoded, then the body of the post is + * sent as the message to a destination that is derived from a query parameter, the URL or the default destination. * * @param request * @param response @@ -110,30 +119,30 @@ log.debug("POST client="+client+" session="+request.getSession().getId()+" info="+request.getPathInfo()+" contentType="+request.getContentType()); // dump(request.getParameterMap()); } - String[] destinations = request.getParameterValues("destination"); - String[] messages = request.getParameterValues("message"); - String[] types = request.getParameterValues("type"); - if (destinations.length!=messages.length || messages.length!=types.length) - { - if (log.isDebugEnabled()) { - log.debug("ERROR destination="+destinations.length+" message="+messages.length+" type="+types.length); - } - response.sendError(HttpServletResponse.SC_BAD_REQUEST,"missmatched destination, message or type"); - return; - } + int messages=0; - for (int i=0;i0) { - amq._messageQueue+=(amq._messages==0?'destination=':'&destination=')+destination+'&message='+message+'&type='+type; + if (amq._messages==0) + { + amq._messageQueue='destination='+destination+'&message='+message+'&type='+type; + } + else + { + amq._messageQueue='d'+amq._messages+'='+destination+'&m'+amq._messages+'='+message+'&t'+amq._messages+'='+type; + } amq._messages++; } else