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