Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 42756 invoked from network); 6 May 2009 20:21:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 May 2009 20:21:58 -0000 Received: (qmail 27394 invoked by uid 500); 6 May 2009 20:21:57 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 27341 invoked by uid 500); 6 May 2009 20:21:56 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 27331 invoked by uid 99); 6 May 2009 20:21:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 20:21:56 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.217.166] (HELO mail-gx0-f166.google.com) (209.85.217.166) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 20:21:48 +0000 Received: by gxk10 with SMTP id 10so578054gxk.13 for ; Wed, 06 May 2009 13:21:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.65.5 with SMTP id n5mr1384477aga.11.1241641283965; Wed, 06 May 2009 13:21:23 -0700 (PDT) In-Reply-To: <25aac9fc0905061009t5a4538f6r6f0dff5c86e5f98d@mail.gmail.com> References: <1644d9770904291344y7353c8b5of4eaff02a06fe4ca@mail.gmail.com> <25aac9fc0904291813r6560267bg3f1c2378fecd35ce@mail.gmail.com> <1644d9770905060956u53281d46gcc82532205226a1d@mail.gmail.com> <25aac9fc0905061009t5a4538f6r6f0dff5c86e5f98d@mail.gmail.com> Date: Wed, 6 May 2009 14:21:23 -0600 Message-ID: <1644d9770905061321m4476014ci8ceb9ec0caa2f512@mail.gmail.com> Subject: Re: Calculating content length From: Ed Young To: JMeter Users List Content-Type: multipart/alternative; boundary=0016361e7e7cab55f5046944235c X-Virus-Checked: Checked by ClamAV on apache.org --0016361e7e7cab55f5046944235c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit You're right. I'm not sure what I was doing incorrectly, but it was likely the way I was quoting the variables or not quoting them in some cases. Luckily it's alot easier than I was making it. I can use either of the __javaScript() or __BeanShell() functions to solve my problem. Thanks. On Wed, May 6, 2009 at 11:09 AM, sebb wrote: > On 06/05/2009, Ed Young wrote: > > Once again, as soon as I posted below, I seem to have solved my problem, > and > > again it's much simpler than I'd made it. > > > > I simply made a user variable something like this: > > > > CONTENT_LENGTH ${__BeanShell("v=0${RTSP_PORT}o=- ${SESSION_ID} 0 IN > IP4 > > ${HOSTNAME}s=t=0 0a=X-playlist-item: ${PROVIDER_ID} ${ASSET_ID}c=IN IP4 > > 0.0.0.0m=video 0 udp MP2T".length())} > > Same would work with __javaScript(). > > > The only issue is whether I need to include the CRLF > __javaScript('\r\n') in > > the content length calculation. I had to omit it from the above > > CONTENT_LENGTH because it seems BeanShell doesn't like having > __javaScript() > > functions passed into it. > > > > BeanShell does not see function calls or variable references as these > are resolved before the string is passed to it. > > But why not just use "\r\n" in the string? > > The only tricky part is where a variable contains double-quotes, in > which case "${VAR}" won't be a valid string. The solution is to use > vars.get("VAR") which is a string. > > > > > On Wed, Apr 29, 2009 at 7:13 PM, sebb wrote: > > > > > > > On 29/04/2009, Ed Young wrote: > > > > Is there a way to calculate the length of some string, including any > > > > embedded variables? > > > > > > Why do you need to do this? > > > > > > > It would have to first expand the variables and then do the > > > calculation... > > > > > > Just pass the string to a function that returns its length; variables > > > are resolved before the function is called. > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org > > > > For additional commands, e-mail: > jmeter-user-help@jakarta.apache.org > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org > > > > > > > > > > > > > > -- > > > > - Ed > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org > > -- - Ed --0016361e7e7cab55f5046944235c--