2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file xmltooling/io/GenericResponse.h
24 * Interface to generic protocol responses that transport XML messages.
27 #ifndef __xmltooling_genres_h__
28 #define __xmltooling_genres_h__
30 #include <xmltooling/base.h>
33 namespace xmltooling {
36 * Interface to generic protocol responses that transport XML messages.
38 * <p>This interface need not be threadsafe.
40 class XMLTOOL_API GenericResponse {
41 MAKE_NONCOPYABLE(GenericResponse);
45 virtual ~GenericResponse();
48 * Sets or clears the MIME type of the response.
50 * @param type the MIME type, or nullptr to clear
52 virtual void setContentType(const char* type=nullptr)=0;
55 * Sends a completed response to the client along with a
56 * transport-specific "OK" indication. Used for "normal" responses.
58 * @param inputStream reference to source of response data
59 * @return a result code to return from the calling MessageEncoder
61 virtual long sendResponse(std::istream& inputStream)=0;
64 * Sends an "error" response to the client along with a
65 * transport-specific error indication.
67 * @param inputStream reference to source of response data
68 * @return a result code to return from the calling MessageEncoder
70 virtual long sendError(std::istream& inputStream)=0;
73 * Sends a completed response to the client.
75 * @param inputStream reference to source of response data
76 * @param status transport-specific status to return
77 * @return a result code to return from the calling MessageEncoder
79 virtual long sendResponse(std::istream& inputStream, long status)=0;
83 #endif /* __xmltooling_genres_h__ */