001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.rest.client; 014 015import org.apache.http.*; 016 017/** 018 * Used to intercept http connection responses to allow modification of that response before processing and for 019 * listening for call lifecycle events. 020 * 021 * <p> 022 * Useful if you want to prevent {@link RestCallException RestCallExceptions} from being thrown on error conditions. 023 * 024 * @deprecated Use {@link org.apache.juneau.rest.client2.RestCallInterceptor} class. 025 */ 026@Deprecated 027public abstract class RestCallInterceptor { 028 029 /** 030 * Called when {@link RestCall} object is created. 031 * 032 * @param restCall The restCall object invoking this method. 033 */ 034 public void onInit(RestCall restCall) {} 035 036 /** 037 * Called immediately after an HTTP response has been received. 038 * 039 * @param statusCode The HTTP status code received. 040 * @param restCall The restCall object invoking this method. 041 * @param req The HTTP request object. 042 * @param res The HTTP response object. 043 */ 044 public void onConnect(RestCall restCall, int statusCode, HttpRequest req, HttpResponse res) {} 045 046 /** 047 * Called if retry is going to be attempted. 048 * 049 * @param statusCode The HTTP status code received. 050 * @param restCall The restCall object invoking this method. 051 * @param req The HTTP request object. 052 * @param res The HTTP response object. 053 * @param ex The exception thrown from the client. 054 */ 055 public void onRetry(RestCall restCall, int statusCode, HttpRequest req, HttpResponse res, Exception ex) {} 056 057 /** 058 * Called when {@link RestCall#close()} is called. 059 * 060 * @param restCall The restCall object invoking this method. 061 * @throws RestCallException Error occurred during call. 062 */ 063 public void onClose(RestCall restCall) throws RestCallException {} 064}