Revize e60f81f3
Přidáno uživatelem Eliška Mourycová před více než 3 roky(ů)
Server/ServerApp/Connection/ConnectionListener.cs | ||
---|---|---|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
|
126 |
|
|
127 |
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); |
|
128 |
|
|
129 |
// Get a response stream and write the response to it. |
|
130 |
response.ContentLength64 = buffer.Length; |
|
131 | 126 |
System.IO.Stream output = response.OutputStream; |
132 |
output.Write(buffer, 0, buffer.Length); |
|
127 |
if (!string.IsNullOrEmpty(responseString)) |
|
128 |
{ |
|
129 |
Console.WriteLine("Response is not null or empty, sending it to the client."); |
|
130 |
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); |
|
131 |
|
|
132 |
// Get a response stream and write the response to it. |
|
133 |
response.ContentLength64 = buffer.Length; |
|
134 |
output.Write(buffer, 0, buffer.Length); |
|
135 |
} |
|
136 |
else |
|
137 |
{ |
|
138 |
Console.WriteLine("Response was null or empty, not sending anything."); |
|
139 |
} |
|
140 |
|
|
133 | 141 |
|
134 | 142 |
// Close the output stream. |
135 | 143 |
output.Close(); |
... | ... | |
178 | 186 |
// get the prediction from the model: |
179 | 187 |
Response responsePrediction = predictionController.Predict(requestDeserialized); |
180 | 188 |
|
189 |
string constructedXml = XmlCommunication.Serialize(responsePrediction); |
|
190 |
Console.WriteLine("Constructed response:"); |
|
191 |
Console.WriteLine(constructedXml); |
|
181 | 192 |
|
182 | 193 |
// build the xml from the prediction: - TODO mbe an exception can happen here as well? - it shouldnt |
183 |
return XmlCommunication.Serialize(responsePrediction); |
|
194 |
return constructedXml;//XmlCommunication.Serialize(responsePrediction);
|
|
184 | 195 |
|
185 | 196 |
|
186 | 197 |
} |
... | ... | |
213 | 224 |
Response responsePrediction = predictionController.Predict(requestDeserialized); |
214 | 225 |
|
215 | 226 |
|
227 |
string constructedXml = XmlCommunication.Serialize(responsePrediction); |
|
228 |
Console.WriteLine("Constructed response:"); |
|
229 |
Console.WriteLine(constructedXml); |
|
230 |
|
|
216 | 231 |
// build the xml from the prediction: - TODO mbe an exception can happen here as well? - it shouldnt |
217 |
return XmlCommunication.Serialize(responsePrediction); |
|
232 |
return constructedXml;//XmlCommunication.Serialize(responsePrediction);
|
|
218 | 233 |
|
219 | 234 |
|
220 | 235 |
|
Také k dispozici: Unified diff
Re #8943. More debug info added to comminication handling.