1 /*
2 * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 package edu.internet2.middleware.shibboleth.idp.profile;
18
19 import java.io.IOException;
20 import java.io.OutputStreamWriter;
21
22 import org.opensaml.ws.transport.InTransport;
23 import org.opensaml.ws.transport.OutTransport;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 import edu.internet2.middleware.shibboleth.common.profile.provider.AbstractRequestURIMappedProfileHandler;
28
29 /**
30 * A simple profile handler that returns the string "ok" if the IdP is able to answer the request. This may be used for
31 * very basic monitoring of the IdP.
32 */
33 public class StatusProfileHandler extends AbstractRequestURIMappedProfileHandler {
34
35 /** Class logger. */
36 private final Logger log = LoggerFactory.getLogger(StatusProfileHandler.class);
37
38 /** {@inheritDoc} */
39 public void processRequest(InTransport in, OutTransport out) {
40 try {
41 OutputStreamWriter writer = new OutputStreamWriter(out.getOutgoingStream());
42 writer.write("ok");
43 writer.flush();
44 } catch (IOException e) {
45 log.error("Unable to write response", e);
46 }
47 }
48 }