1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (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.mozilla.org/MPL/MPL-1.1.html 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 import org.as2lib.core.BasicClass; 18 import org.as2lib.env.overload.Overload; 19 20 /** 21 * {@code AbstractServerServiceProxy} offers default implementations of some methods 22 * needed when implementing the {@link ServerServiceProxy} interface. 23 * 24 * @author Simon Wacker 25 */ 26 class org.as2lib.io.conn.core.server.AbstractServerServiceProxy extends BasicClass { 27 28 /** 29 * Generates a service url with passed-in {@code host} and service {@code path}. 30 * 31 * <p>If the passed-in {@code host} is {@code null}, {@code undefined} or an empty 32 * string the passed-in {@code path} will be returned unchanged. 33 * 34 * @param host the host of the required service 35 * @param path the path of the required service 36 * @return the generated service url 37 */ 38 public static function generateServiceUrl(host:String, path:String):String { 39 if (!host) return path; 40 return host + "/" + path; 41 } 42 43 /** 44 * Private constructor. 45 */ 46 private function AbstractServerServiceProxy(Void) { 47 } 48 49 /** 50 * @overload invokeMethodByNameAndArguments 51 * @overload invokeMethodByNameAndArgumentsAndResponseService 52 * @see ServerServiceProxy#invokeMethod 53 */ 54 public function invokeMethod():Void { 55 var o:Overload = new Overload(this); 56 o.addHandler([String, Array], this["invokeMethodByNameAndArguments"]); 57 o.addHandler([String, Array, String], this["invokeMethodByNameAndArgumentsAndResponseService"]); 58 o.forward(arguments); 59 } 60 61 }