1
22
23 package com.liferay.portal.kernel.util;
24
25 import javax.portlet.ActionRequest;
26 import javax.portlet.PortletRequest;
27 import javax.portlet.PortletResponse;
28 import javax.portlet.RenderRequest;
29
30 import javax.servlet.http.HttpServletRequest;
31 import javax.servlet.http.HttpServletResponse;
32 import javax.servlet.http.HttpSession;
33
34
40 public class PortalUtil {
41
42 public static String getCDNHost() throws Exception {
43 Object returnObj = PortalClassInvoker.invoke(
44 _CLASS, _METHOD_GETCDNHOST, false);
45
46 if (returnObj != null) {
47 return (String)returnObj;
48 }
49 else {
50 return null;
51 }
52 }
53
54 public static String getComputerName() throws Exception {
55 Object returnObj = PortalClassInvoker.invoke(
56 _CLASS, _METHOD_GETCOMPUTERNAME, false);
57
58 if (returnObj != null) {
59 return (String)returnObj;
60 }
61 else {
62 return null;
63 }
64 }
65
66 public static HttpServletRequest getHttpServletRequest(PortletRequest req)
67 throws Exception {
68
69 Object returnObj = PortalClassInvoker.invoke(
70 _CLASS, _METHOD_GETHTTPSERVLETREQUEST, req, false);
71
72 if (returnObj != null) {
73 return (HttpServletRequest)returnObj;
74 }
75 else {
76 return null;
77 }
78 }
79
80 public static HttpServletResponse getHttpServletResponse(
81 PortletResponse res)
82 throws Exception {
83
84 Object returnObj = PortalClassInvoker.invoke(
85 _CLASS, _METHOD_GETHTTPSERVLETRESPONSE, res, false);
86
87 if (returnObj != null) {
88 return (HttpServletResponse)returnObj;
89 }
90 else {
91 return null;
92 }
93 }
94
95 public static String getPortletNamespace(String portletId)
96 throws Exception {
97
98 Object returnObj = PortalClassInvoker.invoke(
99 _CLASS, _METHOD_GETPORTLETNAMESPACE, portletId, false);
100
101 if (returnObj != null) {
102 return (String)returnObj;
103 }
104 else {
105 return null;
106 }
107 }
108
109 public static String getUserPassword(HttpSession ses)
110 throws Exception {
111
112 Object returnObj = PortalClassInvoker.invoke(
113 _CLASS, _METHOD_GETUSERPASSWORD, ses, false);
114
115 if (returnObj != null) {
116 return (String)returnObj;
117 }
118 else {
119 return null;
120 }
121 }
122
123 public static String getUserPassword(HttpServletRequest req)
124 throws Exception {
125
126 Object returnObj = PortalClassInvoker.invoke(
127 _CLASS, _METHOD_GETUSERPASSWORD, req, false);
128
129 if (returnObj != null) {
130 return (String)returnObj;
131 }
132 else {
133 return null;
134 }
135 }
136
137 public static String getUserPassword(ActionRequest req)
138 throws Exception {
139
140 Object returnObj = PortalClassInvoker.invoke(
141 _CLASS, _METHOD_GETUSERPASSWORD, req, false);
142
143 if (returnObj != null) {
144 return (String)returnObj;
145 }
146 else {
147 return null;
148 }
149 }
150
151 public static String getUserPassword(RenderRequest req)
152 throws Exception {
153
154 Object returnObj = PortalClassInvoker.invoke(
155 _CLASS, _METHOD_GETUSERPASSWORD, req, false);
156
157 if (returnObj != null) {
158 return (String)returnObj;
159 }
160 else {
161 return null;
162 }
163 }
164
165 public static void setPageSubtitle(
166 String subtitle, HttpServletRequest req)
167 throws Exception {
168
169 PortalClassInvoker.invoke(
170 _CLASS, _METHOD_SETPAGESUBTITLE, subtitle, req, false);
171 }
172
173 public static void setPageTitle(String title, HttpServletRequest req)
174 throws Exception {
175
176 PortalClassInvoker.invoke(
177 _CLASS, _METHOD_SETPAGETITLE, title, req, false);
178 }
179
180 private static final String _CLASS = "com.liferay.portal.util.PortalUtil";
181
182 private static final String _METHOD_GETCDNHOST = "getCDNHost";
183
184 private static final String _METHOD_GETCOMPUTERNAME = "getComputerName";
185
186 private static final String _METHOD_GETHTTPSERVLETREQUEST =
187 "getHttpServletRequest";
188
189 private static final String _METHOD_GETHTTPSERVLETRESPONSE =
190 "getHttpServletResponse";
191
192 private static final String _METHOD_GETPORTLETNAMESPACE =
193 "getPortletNamespace";
194
195 private static final String _METHOD_GETUSERPASSWORD = "getUserPassword";
196
197 private static final String _METHOD_SETPAGESUBTITLE = "setPageSubtitle";
198
199 private static final String _METHOD_SETPAGETITLE = "setPageTitle";
200
201 }