View Javadoc

    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   * @deprecated
    34   */
    35  public class StatusProfileHandler extends AbstractRequestURIMappedProfileHandler {
    36
    37      /** Class logger. */
    38      private final Logger log = LoggerFactory.getLogger(StatusProfileHandler.class);
    39
    40      /** {@inheritDoc} */
    41      public void processRequest(InTransport in, OutTransport out) {
    42          log.warn("This profile handler has been deprecated, use the Status servlet usually located at '/idp/status'");
    43          try {
    44              OutputStreamWriter writer = new OutputStreamWriter(out.getOutgoingStream());
    45              writer.write("ok");
    46              writer.flush();
    47          } catch (IOException e) {
    48              log.error("Unable to write response", e);
    49          }
    50      }
    51  }