All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.signalfx.shaded.jetty.client.ProtocolHandler Maven / Gradle / Ivy

The newest version!
//
//  ========================================================================
//  Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others.
//  ------------------------------------------------------------------------
//  All rights reserved. This program and the accompanying materials
//  are made available under the terms of the Eclipse Public License v1.0
//  and Apache License v2.0 which accompanies this distribution.
//
//      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//

package com.signalfx.shaded.jetty.client;

import com.signalfx.shaded.jetty.client.api.Request;
import com.signalfx.shaded.jetty.client.api.Response;

/**
 * 

A protocol handler performs HTTP protocol operations on * behalf of the application, typically like a browser would.

*

A typical example is handling HTTP redirects. {@link HttpClient} * could just return the redirect response to the application, * but the application would have to implement the redirect * functionality (while browsers do this automatically).

*/ public interface ProtocolHandler { /** * @return a unique name among protocol handlers */ String getName(); /** *

Inspects the given {@code request} and {@code response} * to detect whether this protocol handler should handle them.

*

For example, a redirect protocol handler can inspect the * response code and return true if it is a redirect response code.

*

This method is being called just after the response line has * been parsed, and before the response headers are available.

* * @param request the request to accept * @param response the response to accept * @return true if this protocol handler can handle the given request and response */ boolean accept(Request request, Response response); /** * @return a response listener that will handle the request and response * on behalf of the application. */ Response.Listener getResponseListener(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy