ThemeServiceHttp.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.LongWrapper; 25 import com.liferay.portal.kernel.util.MethodWrapper; 26 import com.liferay.portal.security.auth.HttpPrincipal; 27 import com.liferay.portal.service.ThemeServiceUtil; 28 29 /** 30 * <a href="ThemeServiceHttp.java.html"><b><i>View Source</i></b></a> 31 * 32 * <p> 33 * ServiceBuilder generated this class. Modifications in this class will be 34 * overwritten the next time is generated. 35 * </p> 36 * 37 * <p> 38 * This class provides a HTTP utility for the 39 * <code>com.liferay.portal.service.ThemeServiceUtil</code> service 40 * utility. The static methods of this class calls the same methods of the 41 * service utility. However, the signatures are different because it requires an 42 * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> 43 * parameter. 44 * </p> 45 * 46 * <p> 47 * The benefits of using the HTTP utility is that it is fast and allows for 48 * tunneling without the cost of serializing to text. The drawback is that it 49 * only works with Java. 50 * </p> 51 * 52 * <p> 53 * Set the property <code>tunnel.servlet.hosts.allowed</code> in 54 * portal.properties to configure security. 55 * </p> 56 * 57 * <p> 58 * The HTTP utility is only generated for remote services. 59 * </p> 60 * 61 * @author Brian Wing Shun Chan 62 * 63 * @see com.liferay.portal.security.auth.HttpPrincipal 64 * @see com.liferay.portal.service.ThemeServiceUtil 65 * @see com.liferay.portal.service.http.ThemeServiceSoap 66 * 67 */ 68 public class ThemeServiceHttp { 69 public static java.util.List<com.liferay.portal.model.Theme> getThemes( 70 HttpPrincipal httpPrincipal, long companyId) 71 throws com.liferay.portal.SystemException { 72 try { 73 Object paramObj0 = new LongWrapper(companyId); 74 75 MethodWrapper methodWrapper = new MethodWrapper(ThemeServiceUtil.class.getName(), 76 "getThemes", new Object[] { paramObj0 }); 77 78 Object returnObj = null; 79 80 try { 81 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper); 82 } 83 catch (Exception e) { 84 throw new com.liferay.portal.SystemException(e); 85 } 86 87 return (java.util.List<com.liferay.portal.model.Theme>)returnObj; 88 } 89 catch (com.liferay.portal.SystemException se) { 90 _log.error(se, se); 91 92 throw se; 93 } 94 } 95 96 public static com.liferay.portal.kernel.json.JSONArray getWARThemes( 97 HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException { 98 try { 99 MethodWrapper methodWrapper = new MethodWrapper(ThemeServiceUtil.class.getName(), 100 "getWARThemes", new Object[0]); 101 102 Object returnObj = null; 103 104 try { 105 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper); 106 } 107 catch (Exception e) { 108 throw new com.liferay.portal.SystemException(e); 109 } 110 111 return (com.liferay.portal.kernel.json.JSONArray)returnObj; 112 } 113 catch (com.liferay.portal.SystemException se) { 114 _log.error(se, se); 115 116 throw se; 117 } 118 } 119 120 private static Log _log = LogFactoryUtil.getLog(ThemeServiceHttp.class); 121 }