Application.cfc에서 onMissingTemplate() 메서드를 사용하여 ColdFusion 응용 프로그램에서 404 오류를 처리하려고합니다.onMissingTemplate()이 작동하지 않는 Coldfusion 8에서 404 오류 처리
My dev 환경은 ColdFusion 8 (dev edition) + JRun + Linux입니다. 에서 [을 web_root] /testmissing/Application.cfc 나는 CF의 문서에서 코드를 가지고 : 나는 /testmissing/foo.cfm를 탐색 할 때
<cfcomponent>
<cffunction name="onMissingTemplate">
<cfargument name="targetPage" type="string" required=true/>
<!--- Use a try block to catch errors. --->
<cftry>
<!--- Log all errors. --->
<cflog type="error" text="Missing template: #Arguments.targetPage#">
<!--- Display an error message. --->
<cfoutput>
<h3>#Arguments.targetPage# could not be found.</h2>
<p>You requested a non-existent ColdFusion page.<br />
Please check the URL.</p>
</cfoutput>
<cfreturn true />
<!--- If an error occurs, return false and the default error
handler will run. --->
<cfcatch>
<cfreturn false />
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>
나는 기본적 CF '파일을 찾을 수 없습니다 ... "오류 페이지를.
Coldfusion 9 (dev edition) + Apache + Windows에서 같은 코드를 시도했습니다. /testmissing/foo.cfm을 탐색하면 onMissingTemplate에서 예상 한 바와 같이 custome 오류 메시지가 나타납니다.
이것은 코드가 정상이며 문제가 내 dev 환경의 어딘가에 있음을 보여 주지만 찾을 수 없습니다. 내가 왜 여전히 기본 CF 오류 페이지를 얻는 지 알고 싶습니다.
CF8 및 CF9 환경에서 비어 있습니다. 프로덕션 서버는 다른 CF 응용 프로그램과 공유되므로 404 오류를 포착하고 싶지 않습니다. 그래서 저는 어플리케이션 레벨에서 404를 처리하려고합니다. – Michlis