First off, it was great to meet and converse with so many of you at CFObjective! I'm already looking forward to next year!
I'm debating whether or not this is an app issue or an IIS issue....
In my API I am returning a 204 status header on some of my endpoints. 204 does not send any content back so I use event.noRender() after my endpoint executes. The problem that is occurring however is the content-length header is returning a value (ie 2629) when it should really return 0. I tried to force a content-length header with value 0 at the end of my request but it doesn't seem to overwrite the value. I'm struggling to figure out how to correct this, and can't determine why/how the content-length header is populated with that value. Hoping someone on the list might have an approach.
Cheers, and thanks.
My guess is you are seeing the amount of whitepace generated by ColdFusion. In the event you need "zero" content, perhaps you could try calling clearBuffer() as the last item in the request? I think you have to do this before onRequestEnd, but, I'm not sure.
Makes sense. I'll give that a go and let you know if that does the trick. Thanks.
Is clearBuffer() part of the CB framework or is this native to CF? i.e getPageContext().getCFOutput()
There are a two ways:
It looks like this will work with getPageContext()..... however I only want this this to execute on responses with 204. I'm setting the 204 header further up the request chain so i'm wondering how I would programatically call the clearBuffer() only if the 204 header had been set. Would this be as simple as adding a var to the RC or PRC and checking for it's existence in the onRequestEnd()? If exists, clearBuffer()? Or would you suggest another approach to evaulate the 204 header?
Thanks very much.
First, I would try checking your for a value in the RC using an interceptor’s postRender() event interception. If you have a response object you can check the status code. Otherwise, just check for a boolean or something in the PRC.
If you still have whitespace, I would break the framework and assign a request.foo variable and check for it in ColdFusion’s native Application.cfc framework. The ColdBox source code is really clean with respect to writing the rendered content to the output stream without having any indents or other code that can cause whitespace–so, you may not need to go outside the framework.
Please share your results!
In the core: coldbox.system.remote.RemotingUtil.cfc already has this functionality available for all engines.
Luis F. Majano
Ortus Solutions, Corp
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
IECFUG Manager: http://www.iecfug.com
Social: twitter.com/lmajano facebook.com/lmajano