Created
May 23, 2016 11:02
-
-
Save eduard93/02fb1d3c98500334f2fed3c27dbb2320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2016.1 (Build 656U)" ts="2016-05-23 14:01:39"> | |
<Class name="A.REST"> | |
<Super>%CSP.REST</Super> | |
<TimeChanged>64061,49363.602743</TimeChanged> | |
<TimeCreated>64059,79624.126107</TimeCreated> | |
<XData name="UrlMap"> | |
<Data><![CDATA[ | |
<Routes> | |
<Route Url="/Test/:redirect" Method="GET" Call="Test"/> | |
</Routes> | |
]]></Data> | |
</XData> | |
<Method name="Test"> | |
<ClassMethod>1</ClassMethod> | |
<FormalSpec>Redirect:%Boolean=$$$YES</FormalSpec> | |
<ReturnType>%Status</ReturnType> | |
<Implementation><![CDATA[ | |
Set str = $TR($J("",4098)," ","1") // Get a string with the length of 4098 symbols | |
Do:Redirect ..OutputToStr($Classname(), "UnrelatedAction") | |
Write str | |
Return $$$OK | |
]]></Implementation> | |
</Method> | |
<Method name="UnrelatedAction"> | |
<ClassMethod>1</ClassMethod> | |
<Implementation><![CDATA[ Set a=1 | |
]]></Implementation> | |
</Method> | |
<Method name="OutputToStr"> | |
<Description><![CDATA[ | |
Executes actions and returns device output <br> | |
pObj - OREF or class<br> | |
pMethod - instance or class method to execute respectively<br> | |
pArgs - additional arguments]]></Description> | |
<ClassMethod>1</ClassMethod> | |
<FormalSpec>pObj,pMethod,pArgs...</FormalSpec> | |
<ProcedureBlock>0</ProcedureBlock> | |
<ReturnType>%String</ReturnType> | |
<Implementation><![CDATA[ | |
try { | |
set str="" | |
//Redirect IO to the current routine - makes use of the labels defined below | |
use $io::("^"_$ZNAME) | |
//Enable redirection | |
do ##class(%Device).ReDirectIO(1) | |
if $isobject(pObj) { | |
do $Method(pObj,pMethod,pArgs...) | |
} elseif $$$comClassDefined(pObj) { | |
do $ClassMethod(pObj,pMethod,pArgs...) | |
} | |
//Disable redirection | |
do ##class(%Device).ReDirectIO(0) | |
} catch ex { | |
if ##class(%Device).ReDirectIO() { | |
do ##class(%Device).ReDirectIO(0) | |
} | |
set str = "" | |
} | |
quit str | |
//Labels that allow for IO redirection | |
//Read Character - we don't care about reading | |
rchr(c) quit | |
//Read a string - we don't care about reading | |
rstr(sz,to) quit | |
//Write a character - call the output label | |
wchr(s) do output($char(s)) quit | |
//Write a form feed - call the output label | |
wff() do output($char(12)) quit | |
//Write a newline - call the output label | |
wnl() do output($char(13,10)) quit | |
//Write a string - call the output label | |
wstr(s) do output(s) quit | |
//Write a tab - call the output label | |
wtab(s) do output($char(9)) quit | |
//Output label - this is where you would handle what you actually want to do. | |
// in our case, we want to write to str | |
output(s) set str=str_s quit | |
]]></Implementation> | |
</Method> | |
</Class> | |
</Export> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment