X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fbinding%2FHTTPResponse.h;h=6c87fdb0381543bc1d6053c5b9065040bf006c3f;hb=46ac496b77b850309c07e732ff89fa41c776915d;hp=b94e6411277f0f3644e03dd8003a098e6a245e31;hpb=93f27cbab489efed65b89371b6cf13ae6fb8e2f3;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/binding/HTTPResponse.h b/saml/binding/HTTPResponse.h index b94e641..6c87fdb 100644 --- a/saml/binding/HTTPResponse.h +++ b/saml/binding/HTTPResponse.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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. @@ -77,12 +85,14 @@ namespace opensaml { SAML_HTTP_STATUS_ERROR = 500 }; + using GenericResponse::sendResponse; + long sendError(std::istream& inputStream) { - return static_cast(this)->sendResponse(inputStream, SAML_HTTP_STATUS_ERROR); + return sendResponse(inputStream, SAML_HTTP_STATUS_ERROR); } long sendResponse(std::istream& inputStream) { - return static_cast(this)->sendResponse(inputStream, SAML_HTTP_STATUS_OK); + return sendResponse(inputStream, SAML_HTTP_STATUS_OK); } }; };