@@ -434,9 +434,17 @@ Method returns user application CSS.</Description>
434434<ClassMethod >1</ClassMethod >
435435<ReturnType >%Status</ReturnType >
436436<Implementation ><![CDATA[
437+ #define CompileTime ##Expression("""" _ $zd($h, 11) _ ", "_ $zdt($NOW(0), 2,1) _ " GMT""")
437438 set %response.CharSet = "utf-8"
438439 set %response.ContentType = "text/css"
439- do ##class(StaticContent).Write("CSS")
440+ do %response.SetHeader("Last-Modified", $$$CompileTime)
441+
442+ if %request.GetCgiEnv("HTTP_IF_MODIFIED_SINCE")=$$$CompileTime {
443+ do ..Http304()
444+ } else {
445+ do ##class(StaticContent).Write("CSS")
446+ }
447+
440448 return $$$OK
441449]]> </Implementation >
442450</Method >
@@ -447,9 +455,17 @@ Method returns user application JavaScript.</Description>
447455<ClassMethod >1</ClassMethod >
448456<ReturnType >%Status</ReturnType >
449457<Implementation ><![CDATA[
458+ #define CompileTime ##Expression("""" _ $zd($h, 11) _ ", "_ $zdt($NOW(0), 2,1) _ " GMT""")
450459 set %response.CharSet = "utf-8"
451460 set %response.ContentType = "text/javascript"
452- do ##class(StaticContent).Write("JS")
461+ do %response.SetHeader("Last-Modified", $$$CompileTime)
462+
463+ if %request.GetCgiEnv("HTTP_IF_MODIFIED_SINCE")=$$$CompileTime {
464+ do ..Http304()
465+ } else {
466+ do ##class(StaticContent).Write("JS")
467+ }
468+
453469 return $$$OK
454470]]> </Implementation >
455471</Method >
@@ -460,10 +476,29 @@ Method returns user application HTML.</Description>
460476<ClassMethod >1</ClassMethod >
461477<ReturnType >%Status</ReturnType >
462478<Implementation ><![CDATA[
463- do ##class(StaticContent).Write("HTML")
479+ #define CompileTime ##Expression("""" _ $zd($h, 11) _ ", "_ $zdt($NOW(0), 2,1) _ " GMT""")
480+ do %response.SetHeader("Last-Modified", $$$CompileTime)
481+
482+ if %request.GetCgiEnv("HTTP_IF_MODIFIED_SINCE")=$$$CompileTime {
483+ do ..Http304()
484+ } else {
485+ do ##class(StaticContent).Write("HTML")
486+ }
487+
464488 return $$$OK
465489]]> </Implementation >
466490</Method >
491+
492+ <Method name =" Http304" >
493+ <Description >
494+ Issue an "304 Not Modified" status</Description >
495+ <ClassMethod >1</ClassMethod >
496+ <ReturnType >%Status</ReturnType >
497+ <Implementation ><![CDATA[
498+ Set %response.Status="304 Not Modified"
499+ Quit $$$OK
500+ ]]> </Implementation >
501+ </Method >
467502</Class >
468503
469504
0 commit comments