Zamples, Inc. logo
 Home   Search   Solutions   My Zamples   FAQ   News   Contact 
Zamples ID:
Password:
   
0 anonymous users;
19 users logged in.

Listing Arbitrary Code

Code examples can be formatted for display in a variety of ways using this REST invocation.  The HTTP POST to the URI /JspExplorer/zamples/list accepts all of the same parameters as for execution of arbitrary code, plus the parameters listed in the table below.  The result is returned in the HTTP response as text/html.  Some of the parameters specific to this REST call are optional (shown like this), and some are mandatory (shown like this):

Field Name Purpose
separator Code ranges will be separated with this HTML markup.  Default is <hr class=zrangeRule>

The following code example specifies the value of ranges in the POST body.  You may also supply ranges in the URL.  Click on the 'Try It!' button to view the code example.

<table>
   <tr>
      <td><form action='/JspExplorer/zamples/list?clientUser=myUid&clientPassword=myPwd' 
                method='post' class='zform' target='TomcatMain'>
         <input type=hidden name=cmd value='One&#32;fine&#32;day... line shortened for clarity'>
         <input type=hidden name=imports value=''>
         <input type=hidden name=applet value=''>
         <input type=hidden name=format value='0'>
         <input type=hidden name=pre value='false'>
         <input type=hidden name=ranges value='1,2
3,4
numbered'>
         <input type=hidden name=stylesheet value='StyleSheet.css'>
         <input type=submit value='Try It!' class='zform'>
      </form></td>
      <td><pre>One+fine+day+...+%3Ci%3Eshortened+for+clarity%3C%2Fi%3E%0D%0A</pre></td>
   </tr>
</table>

Typical Output

Presentation depends on the postings' range parameters, which (as you can see above) were 1,2\n4,5\nnumbered for this example:

1  One fine day 
2  in the middle of the night,

4 Back to back, they faced each other; 5 drew their swords

When supplying multiple ranges, each range must be separated by a newline character.  POST bodies are not encoded when expressed in HTML, so they are particularly easy to work with - simply enclose the entire set of ranges in quotes (web browsers URL-encode the parameter values when the POST is sent).  The bolded lines above are an example of how to do set a multi-line value for ranges.

You can accomplish the same thing by specifying ranges in the URL. Don't forget to URL-encode the ranges when specifying them as part of the URL:

ranges=1%2C2%0D%0A4%2C5%0D%0Anumbered


Execution of Arbitrary Code Zamples Client REST Interface Specification Creation of an HTML "Try It!" Button