Skip to content

Commit 322e5e7

Browse files
committed
COLDBOX-717 #resolve
RemotingUtil converted to cfscript #367
1 parent 4f45efa commit 322e5e7

File tree

1 file changed

+40
-50
lines changed

1 file changed

+40
-50
lines changed

system/remote/RemotingUtil.cfc

Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,45 @@
1-
<!-----------------------------------------------------------------------
2-
********************************************************************************
3-
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
4-
www.ortussolutions.com
5-
********************************************************************************
1+
/**
2+
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3+
* www.ortussolutions.com
4+
* ---
5+
* @author Luis Majano <lmajano@ortussolutions.com>
6+
* Remoting Utility
7+
*/
8+
component{
69

7-
Author : Luis Majano
8-
Description :
9-
A cool remoting utililty component
10-
----------------------------------------------------------------------->
11-
<cfcomponent output="false" hint="A cool remoting utililty component" >
12-
13-
<!---
10+
/*
1411
Based on original function by Elliot Sprehn, found here
1512
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000271.htm
1613
by Chris Blackwell
17-
--->
18-
<cffunction name="clearHeaderBuffer" output="false" access="public" returntype="void" hint="Clear the CFHTMLHead buffer">
19-
<cfset var my = structnew() />
20-
21-
<cfswitch expression="#trim(server.coldfusion.productname)#">
22-
23-
<cfcase value="ColdFusion Server">
24-
<cfset my.out = getPageContext().getOut() />
25-
26-
<!--- It's necessary to iterate over this until we get to a coldfusion.runtime.NeoJspWriter --->
27-
<cfloop condition="getMetaData(my.out).getName() is 'coldfusion.runtime.NeoBodyContent'">
28-
<cfset my.out = my.out.getEnclosingWriter() />
29-
</cfloop>
30-
31-
<cfset my.method = my.out.getClass().getDeclaredMethod("initHeaderBuffer", arrayNew(1)) />
32-
<cfset my.method.setAccessible(true) />
33-
<cfset my.method.invoke(my.out, arrayNew(1)) />
34-
35-
</cfcase>
36-
37-
38-
<cfcase value="Lucee">
39-
40-
<cfset my.out = getPageContext().getOut() />
41-
42-
<cfloop condition="getMetaData(my.out).getName() is 'lucee.runtime.writer.BodyContentImpl'">
43-
<cfset my.out = my.out.getEnclosingWriter() />
44-
</cfloop>
45-
46-
<cfset my.headData = my.out.getClass().getDeclaredField("headData") />
47-
<cfset my.headData.setAccessible(true) />
48-
<cfset my.headData.set(my.out, createObject("java", "java.lang.String").init("")) />
49-
50-
</cfcase>
51-
52-
</cfswitch>
53-
</cffunction>
14+
*/
5415

55-
</cfcomponent>
16+
/**
17+
* Clear the CFHTMLHead buffer
18+
*/
19+
void function clearHeaderBuffer(){
20+
var my = {};
21+
22+
switch ( trim( server.coldfusion.productname ) ) {
23+
case "ColdFusion Server" :
24+
my.out = getPageContext().getOut();
25+
// It's necessary to iterate over this until we get to a coldfusion.runtime.NeoJspWriter
26+
while( condition="getMetaData( my.out ).getName() == 'coldfusion.runtime.NeoBodyContent'" ) {
27+
my.out = my.out.getEnclosingWriter();
28+
}
29+
my.method = my.out.getClass().getDeclaredMethod( "initHeaderBuffer", [] );
30+
my.method.setAccessible( true );
31+
my.method.invoke( my.out, [] );
32+
break;
33+
case "Lucee" :
34+
my.out = getPageContext().getOut();
35+
while ( condition="getMetaData( my.out ).getName() == 'lucee.runtime.writer.BodyContentImpl'" ) {
36+
my.out = my.out.getEnclosingWriter();
37+
}
38+
my.headData = my.out.getClass().getDeclaredField( "headData" );
39+
my.headData.setAccessible( true );
40+
my.headData.set( my.out, createObject( "java", "java.lang.String" ).init( "" ) );
41+
break;
42+
}
43+
}
44+
45+
}

0 commit comments

Comments
 (0)