More default methods.
authorScott Cantor <cantor.2@osu.edu>
Sat, 13 Jan 2007 03:39:36 +0000 (03:39 +0000)
committerScott Cantor <cantor.2@osu.edu>
Sat, 13 Jan 2007 03:39:36 +0000 (03:39 +0000)
saml/binding/HTTPResponse.h
samltest/binding.h

index b94e641..7837d60 100644 (file)
@@ -43,6 +43,10 @@ namespace opensaml {
     public:
         virtual ~HTTPResponse() {}
         
+        void setContentType(const char* type) {
+            setResponseHeader("Content-Type", type);
+        }
+        
         /**
          * Sets or clears a response header.
          * 
@@ -57,7 +61,11 @@ namespace opensaml {
          * @param name  cookie name
          * @param value value to set, or NULL to clear
          */
-        virtual void setCookie(const char* name, const char* value)=0;
+        virtual void setCookie(const char* name, const char* value) {
+            std::string cookie(name);
+            cookie = cookie + '=' + value;
+            setResponseHeader("Set-Cookie", cookie.c_str());
+        }
         
         /**
          * Redirect the client to the specified URL and complete the response.
index d4de9c9..2cd28f1 100644 (file)
@@ -194,14 +194,6 @@ public:
         m_headers[name] = value ? value : "";\r
     }\r
 \r
-    void setContentType(const char* type) {\r
-        setResponseHeader("Content-Type", type);\r
-    }\r
-    \r
-    void setCookie(const char* name, const char* value) {\r
-        m_headers["Set-Cookie"] = string(name) + "=" + (value ? value : "");\r
-    }\r
-    \r
     // The amount of error checking missing from this is incredible, but as long\r
     // as the test data isn't unexpected or malformed, it should work.\r
     \r