openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit cc807fe7257fb2b86d5d03231aa3880f3e3dd63d
parent 01633c8a72db388ef1eecba70e3efad300db4e16
Author: Jan Dankert <devnull@localhost>
Date:   Wed,  7 Nov 2012 20:41:05 +0100

Bei fehlenden Methoden nicht 404, sondern 204 als HTTP-Status verwenden.

Diffstat:
dispatcher.php | 12++++++------
util/Http.class.php | 8++++++++
2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dispatcher.php b/dispatcher.php @@ -166,8 +166,8 @@ try } catch( ObjectNotFoundException $e ) { - Logger::warn( $e->__toString() ); - Http::sendStatus(404,"Object not found","The requested object was not found." ); + Logger::debug( "Object not found: ".$e->__toString() ); + Http::noContent(); } catch( Exception $e ) { @@ -229,8 +229,8 @@ else Logger::debug("Executing $actionClassName::$subactionMethodName"); if ( ! method_exists($do,$subactionMethodName) ) - Http::sendStatus(404,"Method not found","Method '".$subactionMethodName."' does not exist in this context" ); - + Http::noContent(); + // Jetzt wird die Aktion aus der Actionklasse aufgerufen. try { @@ -238,8 +238,8 @@ try } catch( ObjectNotFoundException $e ) { - Logger::warn( $e->__toString() ); - Http::sendStatus(404,"Object not found","The requested object was not found." ); + Logger::debug( $e->__toString() ); // Nur Debug, da dies bei gelöschten Objekten vorkommen kann. + Http::noContent(); } $do->forward(); diff --git a/util/Http.class.php b/util/Http.class.php @@ -456,6 +456,14 @@ class Http { Http::sendStatus(404,$text,$message); } + + + + public static function noContent() + { + header('HTTP/1.0 204 No Content'); + exit; + }