2 * Copyright 2001-2010 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file xmltooling/io/GenericResponse.h
20 * Interface to generic protocol responses that transport XML messages.
23 #ifndef __xmltooling_genres_h__
24 #define __xmltooling_genres_h__
26 #include <xmltooling/base.h>
29 namespace xmltooling {
32 * Interface to generic protocol responses that transport XML messages.
34 * <p>This interface need not be threadsafe.
36 class XMLTOOL_API GenericResponse {
37 MAKE_NONCOPYABLE(GenericResponse);
41 virtual ~GenericResponse();
44 * Sets or clears the MIME type of the response.
46 * @param type the MIME type, or nullptr to clear
48 virtual void setContentType(const char* type=nullptr)=0;
51 * Sends a completed response to the client along with a
52 * transport-specific "OK" indication. Used for "normal" responses.
54 * @param inputStream reference to source of response data
55 * @return a result code to return from the calling MessageEncoder
57 virtual long sendResponse(std::istream& inputStream)=0;
60 * Sends an "error" response to the client along with a
61 * transport-specific error indication.
63 * @param inputStream reference to source of response data
64 * @return a result code to return from the calling MessageEncoder
66 virtual long sendError(std::istream& inputStream)=0;
69 * Sends a completed response to the client.
71 * @param inputStream reference to source of response data
72 * @param status transport-specific status to return
73 * @return a result code to return from the calling MessageEncoder
75 virtual long sendResponse(std::istream& inputStream, long status)=0;
79 #endif /* __xmltooling_genres_h__ */