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

org.eclipse.jetty.client.ProtocolHandler Maven / Gradle / Ivy

//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

package org.eclipse.jetty.client;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.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 */ public 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 */ public boolean accept(Request request, Response response); /** * @return a response listener that will handle the request and response * on behalf of the application. */ public Response.Listener getResponseListener(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy