PortalServiceHttp.java |
1 /** 2 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. 3 * 4 * 5 * 6 * 7 * The contents of this file are subject to the terms of the Liferay Enterprise 8 * Subscription License ("License"). You may not use this file except in 9 * compliance with the License. You can obtain a copy of the License by 10 * contacting Liferay, Inc. See the License for the specific language governing 11 * permissions and limitations under the License, including but not limited to 12 * distribution rights of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 * SOFTWARE. 21 */ 22 23 package com.liferay.portal.service.http; 24 25 import com.liferay.portal.kernel.log.Log; 26 import com.liferay.portal.kernel.log.LogFactoryUtil; 27 import com.liferay.portal.kernel.util.MethodWrapper; 28 import com.liferay.portal.security.auth.HttpPrincipal; 29 import com.liferay.portal.service.PortalServiceUtil; 30 31 /** 32 * <a href="PortalServiceHttp.java.html"><b><i>View Source</i></b></a> 33 * 34 * <p> 35 * ServiceBuilder generated this class. Modifications in this class will be 36 * overwritten the next time is generated. 37 * </p> 38 * 39 * <p> 40 * This class provides a HTTP utility for the 41 * {@link com.liferay.portal.service.PortalServiceUtil} service utility. The 42 * static methods of this class calls the same methods of the service utility. 43 * However, the signatures are different because it requires an additional 44 * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter. 45 * </p> 46 * 47 * <p> 48 * The benefits of using the HTTP utility is that it is fast and allows for 49 * tunneling without the cost of serializing to text. The drawback is that it 50 * only works with Java. 51 * </p> 52 * 53 * <p> 54 * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to 55 * configure security. 56 * </p> 57 * 58 * <p> 59 * The HTTP utility is only generated for remote services. 60 * </p> 61 * 62 * @author Brian Wing Shun Chan 63 * @see PortalServiceSoap 64 * @see com.liferay.portal.security.auth.HttpPrincipal 65 * @see com.liferay.portal.service.PortalServiceUtil 66 * @generated 67 */ 68 public class PortalServiceHttp { 69 public static void test(HttpPrincipal httpPrincipal) 70 throws com.liferay.portal.SystemException { 71 try { 72 MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(), 73 "test", new Object[0]); 74 75 try { 76 TunnelUtil.invoke(httpPrincipal, methodWrapper); 77 } 78 catch (Exception e) { 79 throw new com.liferay.portal.SystemException(e); 80 } 81 } 82 catch (com.liferay.portal.SystemException se) { 83 _log.error(se, se); 84 85 throw se; 86 } 87 } 88 89 public static void testCounterRollback(HttpPrincipal httpPrincipal) 90 throws com.liferay.portal.SystemException { 91 try { 92 MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(), 93 "testCounterRollback", new Object[0]); 94 95 try { 96 TunnelUtil.invoke(httpPrincipal, methodWrapper); 97 } 98 catch (Exception e) { 99 if (e instanceof com.liferay.portal.SystemException) { 100 throw (com.liferay.portal.SystemException)e; 101 } 102 103 throw new com.liferay.portal.SystemException(e); 104 } 105 } 106 catch (com.liferay.portal.SystemException se) { 107 _log.error(se, se); 108 109 throw se; 110 } 111 } 112 113 private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class); 114 }