Revamped binding classes with security policy layer.
[shibboleth/cpp-opensaml.git] / saml / binding / MessageEncoder.h
index 536acf4..9e611ff 100644 (file)
 #ifndef __saml_encoder_h__
 #define __saml_encoder_h__
 
-#include <saml/base.h>
+#include <saml/binding/GenericResponse.h>
 
-#include <map>
-#include <string>
 #include <istream>
 #include <xmltooling/XMLObject.h>
 #include <xmltooling/signature/CredentialResolver.h>
@@ -48,59 +46,6 @@ namespace opensaml {
         virtual ~MessageEncoder() {}
 
         /**
-         * Interface to caller-supplied shim for issuing an HTTP response.
-         * 
-         * <p>To supply information to the surrounding web server environment,
-         * a shim must be supplied in the form of this interface to adapt the
-         * library to different proprietary server APIs.
-         * 
-         * <p>This interface need not be threadsafe.
-         */
-        class SAML_API HTTPResponse {
-            MAKE_NONCOPYABLE(HTTPResponse);
-        protected:
-            HTTPResponse() {}
-        public:
-            virtual ~HTTPResponse() {}
-            
-            /**
-             * Sets or clears a response header.
-             * 
-             * @param name  header name
-             * @param value value to set, or NULL to clear
-             */
-            virtual void setHeader(const char* name, const char* value)=0;
-
-            /**
-             * Sets a client cookie.
-             * 
-             * @param name  cookie name
-             * @param value value to set, or NULL to clear
-             */
-            virtual void setCookie(const char* name, const char* value)=0;
-            
-            /**
-             * Redirect the client to the specified URL and complete the response.
-             * Any headers previously set will be sent ahead of the redirect.
-             * 
-             * @param url   location to redirect client
-             * @return a result code to return from the calling MessageEncoder
-             */
-            virtual long sendRedirect(const char* url)=0;
-
-            /**
-             * Sends a completed response to the client. Any headers previously set
-             * will be sent ahead of the data.
-             * 
-             * @param inputStream   reference to source of response data
-             * @param status        HTTP status code to return
-             * @param contentType   Content-Type header to return
-             * @return a result code to return from the calling MessageEncoder
-             */
-            virtual long sendResponse(std::istream& inputStream, int status = 200, const char* contentType = "text/html")=0;
-        };
-
-        /**
          * Interface to caller-supplied artifact generation mechanism.
          * 
          * Generating an artifact for storage and retrieval requires knowledge of
@@ -146,7 +91,7 @@ namespace opensaml {
         }
         
         /**
-         * Encodes an XML object/message into a binding-specific HTTP response.
+         * Encodes an XML object/message into a binding- and transport-specific response.
          * The XML content cannot have a parent object, and any existing references to
          * the content will be invalidated if the encode method returns successfully.
          * 
@@ -157,7 +102,7 @@ namespace opensaml {
          * <p>Artifact-based bindings require an ArtifactGenerator be set to
          * produce an artifact suitable for the intended recipient.
          * 
-         * @param httpResponse      reference to interface for sending encoded response to client      
+         * @param genericResponse   reference to interface for sending transport response      
          * @param xmlObject         XML message to encode
          * @param destination       destination URL for message
          * @param recipientID       optional entityID of message recipient
@@ -166,7 +111,7 @@ namespace opensaml {
          * @param sigAlgorithm      optional signature algorithm identifier
          */
         virtual long encode(
-            HTTPResponse& httpResponse,
+            GenericResponse& genericResponse,
             xmltooling::XMLObject* xmlObject,
             const char* destination,
             const char* recipientID=NULL,