KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > http > portlets > HipergateRenderRequest


1 /*
2   Copyright (C) 2003-2006 Know Gate S.L. All rights reserved.
3                            C/Oņa, 107 1š2 28050 Madrid (Spain)
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11
12   2. The end-user documentation included with the redistribution,
13      if any, must include the following acknowledgment:
14      "This product includes software parts from hipergate
15      (http://www.hipergate.org/)."
16      Alternately, this acknowledgment may appear in the software itself,
17      if and wherever such third-party acknowledgments normally appear.
18
19   3. The name hipergate must not be used to endorse or promote products
20      derived from this software without prior written permission.
21      Products derived from this software may not be called hipergate,
22      nor may hipergate appear in their name, without prior written
23      permission.
24
25   This library is distributed in the hope that it will be useful,
26   but WITHOUT ANY WARRANTY; without even the implied warranty of
27   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28
29   You should have received a copy of hipergate License with this code;
30   if not, visit http://www.hipergate.org or mail to info@hipergate.org
31 */

32
33 package com.knowgate.http.portlets;
34
35 import java.util.Hashtable JavaDoc;
36 import java.util.Enumeration JavaDoc;
37 import java.util.Properties JavaDoc;
38 import java.util.Map JavaDoc;
39 import java.util.Locale JavaDoc;
40
41 import java.security.Principal JavaDoc;
42
43 import javax.portlet.*;
44
45 import javax.servlet.http.HttpServletRequest JavaDoc;
46
47 /**
48  * @author Sergio Montoro Ten
49  * @version 1.0
50  */

51
52 public class HipergateRenderRequest implements RenderRequest {
53
54   private HttpServletRequest JavaDoc oSrvltReq;
55   private Properties JavaDoc oProps;
56   private Hashtable JavaDoc oAttrs;
57   private WindowState oWinState;
58
59   public HipergateRenderRequest(HttpServletRequest JavaDoc oServletReq) {
60     oAttrs = new Hashtable JavaDoc();
61     oProps = new Properties JavaDoc();
62     oSrvltReq = oServletReq;
63     oWinState = WindowState.NORMAL;
64   }
65
66   public boolean isWindowStateAllowed(WindowState state) {
67     return state == WindowState.NORMAL;
68   }
69
70   public boolean isPortletModeAllowed(PortletMode mode) {
71     return mode == PortletMode.VIEW;
72   }
73
74   public PortletMode getPortletMode () {
75     return PortletMode.VIEW;
76   }
77
78   public WindowState getWindowState () {
79     return oWinState;
80   }
81
82   public void setWindowState (String JavaDoc state) {
83     if (state.equalsIgnoreCase("NORMAL"))
84       oWinState = WindowState.NORMAL;
85     else if (state.equalsIgnoreCase("MINIMIZED"))
86       oWinState = WindowState.MINIMIZED;
87     else if (state.equalsIgnoreCase("MAXIMIZED"))
88       oWinState = WindowState.MAXIMIZED;
89   }
90
91   public void setWindowState (WindowState state) {
92     oWinState = state;
93   }
94
95   public PortletPreferences getPreferences () {
96     return null;
97   }
98
99   public PortletSession getPortletSession () {
100     return null;
101   }
102
103   public PortletSession getPortletSession (boolean create) {
104     return null;
105   }
106
107   public String JavaDoc getProperty(String JavaDoc name) {
108     return oProps.getProperty(name);
109   }
110
111   public void setProperty(String JavaDoc name, String JavaDoc value) {
112     oProps.put(name, value);
113   }
114
115   public void setProperties(Properties JavaDoc props) {
116     oProps = props;
117   }
118
119   public Enumeration JavaDoc getProperties(String JavaDoc name) {
120     return (Enumeration JavaDoc) oProps;
121   }
122
123   public Enumeration JavaDoc getPropertyNames() {
124     return oProps.keys();
125   }
126
127   public PortalContext getPortalContext() {
128     return null;
129
130   }
131
132   public String JavaDoc getAuthType() {
133     return null;
134   }
135
136   public String JavaDoc getContextPath() {
137     return oSrvltReq.getContextPath();
138   }
139
140   public String JavaDoc getRemoteUser() {
141     return oSrvltReq.getRemoteUser();
142   }
143
144   public Principal JavaDoc getUserPrincipal() {
145     return oSrvltReq.getUserPrincipal();
146   }
147
148   public boolean isUserInRole(String JavaDoc role) {
149     return false;
150   }
151
152   public Object JavaDoc getAttribute(String JavaDoc name) {
153     return oAttrs.get(name);
154   }
155
156   public Enumeration JavaDoc getAttributeNames() {
157     return oAttrs.keys();
158   }
159
160   public String JavaDoc getParameter(String JavaDoc name) {
161     return oSrvltReq.getParameter(name);
162   }
163
164   public Enumeration JavaDoc getParameterNames() {
165     return oSrvltReq.getParameterNames();
166   }
167
168   public String JavaDoc[] getParameterValues(String JavaDoc name) {
169     return oSrvltReq.getParameterValues(name);
170   }
171
172   public Map JavaDoc getParameterMap() {
173     return oSrvltReq.getParameterMap();
174   }
175
176   public boolean isSecure() {
177     return false;
178   }
179
180   public void setAttribute(String JavaDoc name, Object JavaDoc o) {
181     if (oAttrs.containsKey(name)) oAttrs.remove(name);
182     oAttrs.put(name, o);
183   }
184
185   public void removeAttribute(String JavaDoc name) {
186     oAttrs.remove(name);
187   }
188
189   public String JavaDoc getRequestedSessionId() {
190     return oSrvltReq.getRequestedSessionId();
191   }
192
193   public boolean isRequestedSessionIdValid() {
194     return oSrvltReq.isRequestedSessionIdValid();
195   }
196
197   public String JavaDoc getResponseContentType() {
198     throw new UnsupportedOperationException JavaDoc ("getResponseContentType() not implemented at HipergateRenderRequest");
199   }
200
201   public Enumeration JavaDoc getResponseContentTypes() {
202     throw new UnsupportedOperationException JavaDoc ("getResponseContentTypes() not implemented HipergateRenderRequest");
203   }
204
205   public Locale JavaDoc getLocale() {
206     return oSrvltReq.getLocale();
207   }
208
209   public Enumeration JavaDoc getLocales() {
210     return oSrvltReq.getLocales();
211   }
212
213   public String JavaDoc getScheme() {
214     return oSrvltReq.getScheme();
215   }
216
217   public String JavaDoc getServerName() {
218     return oSrvltReq.getServerName();
219   }
220
221   public int getServerPort() {
222     return oSrvltReq.getServerPort();
223   }
224 }
225
Popular Tags