1 /* 2 * Copyright 2002-2005 the original author or authors. 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 org.springframework.remoting.httpinvoker; 18 19 import java.io.IOException; 20 21 import org.springframework.remoting.support.RemoteInvocation; 22 import org.springframework.remoting.support.RemoteInvocationResult; 23 24 /** 25 * Strategy interface for actual execution of an HTTP invoker request. 26 * Used by HttpInvokerClientInterceptor and its subclass 27 * HttpInvokerProxyFactoryBean. 28 * 29 * <p>Two implementations are provided out of the box: 30 * <ul> 31 * <li><b>SimpleHttpInvokerRequestExecutor:</b> 32 * Uses J2SE facilities to execute POST requests, without support 33 * for HTTP authentication or advanced configuration options. 34 * <li><b>CommonsHttpInvokerRequestExecutor:</b> 35 * Uses Jakarta's Commons HttpClient to execute POST requests, 36 * allowing to use a preconfigured HttpClient instance 37 * (potentially with authentication, HTTP connection pooling, etc). 38 * </ul> 39 * 40 * @author Juergen Hoeller 41 * @since 1.1 42 * @see HttpInvokerClientInterceptor#setHttpInvokerRequestExecutor 43 */ 44 public interface HttpInvokerRequestExecutor { 45 46 /** 47 * Execute a request to send the given remote invocation. 48 * @param config the HTTP invoker configuration that specifies the 49 * target service 50 * @param invocation the RemoteInvocation to execute 51 * @return the RemoteInvocationResult object 52 * @throws IOException if thrown by I/O operations 53 * @throws ClassNotFoundException if thrown during deserialization 54 * @throws Exception in case of general errors 55 */ 56 RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation) 57 throws Exception; 58 59 } 60