Hi David, you can actually debug a csp page with the studio debugger. However, this requires a bit more preparation, as you need to identify the csp server process running your page, which is not always straightforward.
An easier approach would be to use the command line debugger in combination with the CSP shell.
SAMPLES>ZBREAK zListFiles+1^csp.menu.1
SAMPLES>d $SYSTEM.CSP.Shell()
CSP Shell
Command shell for debugging CSP pages. It looks and acts like a Cache programmer prompt, but you can use the GET or HEAD command to fetch a CSP page. You can set breakpoints, step into the code etc. You may pass query parameters to the page as well, eg.:CSP>>> GET /csp/samples/request.csp?A=1&B=2
The output you see is what would be sent to the browser, including any HTTP headers. You can also interact with the session, request and response objects via the special variables %session, %request and %response.
CSP:SAMPLES>>> get /csp/samples/menu.csp
200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: CSPSESSIONID-UP-csp-samples-=5864 5864; path=/csp/samples/; httpOnly;
Cache-Control: no-cache
Date: Wed, 09 Nov 2016 17:49:45 GMT
Expires: Thu, 29 Oct 1998 17:04:19 GMT
Pragma: no-cache
<!-- Copyright (c) 2001 InterSystems Inc. ALL RIGHTS RESERVED. -->
<html>
<head>
<title>CSP Samples Menu</title>
<style type="text/css">
body { color: black; background: #CCCCFF; font-size: 12pt; font-family: Verdana,Arial,Helvetica,sans-serif; }
.Small { font-size: 10pt;}
.DarkRow { background: #DDDDDD; }
.LightRow { background: #FFFFFF; }
</style>
</head>
<body bgcolor="#CCCCFF">
<!-- display standard sample template using a custom tag -->
<table bgcolor="#000088" cols="2" width="100%" border="1" cellpadding="3">
<tr>
<td width="50%">
<nobr><font face="Verdana,Arial,Helvetica,sans-serif" color="white" size="+3">
<b> CSP Samples Menu</b>
</font></nobr>
</td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td width="66%"><font face="Verdana,Arial,Helvetica,sans-serif">
This page displays a list of available CSP pages within the same
directory.<br/>
Click this link to see a demonstration of the the <a href="ZENDemo.Home.cls">Zen Web Development Framework</a>.
</font></td>
<td align="right"><font face="Verdana,Arial,Helvetica,sans-serif"><a href="menu.csp">Samples Menu</a></font></td>
<td align="right"><font face="Verdana,Arial,Helvetica,sans-serif"><a href="showsource.csp?PAGE=/csp/samples/menu.csp">Source</a></font></td>
</tr>
</table>
New file,rs,dir,menupath,subdir,list,page,description,url
^
<BREAK>zListFiles+2^csp.menu.1
SAMPLES 15d6>
In this example I am setting the breakpoint to
ZB zListFiles+1^csp.menu.1
and then request the menu page within the CSP shell:
SAMPLES>d $SYSTEM.CSP.Shell()
CSP Shell
Command shell for debugging CSP pages. It looks and acts like a Cache programmer prompt, but you can use the GET or HEAD command to fetch a CSP page. You can set breakpoints, step into the code etc. You may pass query parameters to the page as well, eg.:CSP>>> GET /csp/samples/request.csp?A=1&B=2
The output you see is what would be sent to the browser, including any HTTP headers. You can also interact with the session, request and response objects via the special variables %session, %request and %response.
CSP:SAMPLES>>> get /csp/samples/menu.csp
This drops us into the regular command line debugger.
I hope this helps. -Fab
- Log in to post comments