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