1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.jetspeed.aggregator.impl; |
18 |
|
|
19 |
|
import java.io.IOException; |
20 |
|
import java.util.Iterator; |
21 |
|
import java.util.Map; |
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.List; |
24 |
|
import java.util.ArrayList; |
25 |
|
import java.util.Collections; |
26 |
|
|
27 |
|
import javax.portlet.Portlet; |
28 |
|
|
29 |
|
import org.apache.commons.logging.Log; |
30 |
|
import org.apache.commons.logging.LogFactory; |
31 |
|
|
32 |
|
import org.apache.jetspeed.aggregator.FailedToRenderFragmentException; |
33 |
|
import org.apache.jetspeed.aggregator.PageAggregator; |
34 |
|
import org.apache.jetspeed.container.state.NavigationalState; |
35 |
|
import org.apache.jetspeed.container.url.BasePortalURL; |
36 |
|
import org.apache.jetspeed.container.window.PortletWindowAccessor; |
37 |
|
import org.apache.jetspeed.decoration.DecorationFactory; |
38 |
|
import org.apache.jetspeed.exception.JetspeedException; |
39 |
|
import org.apache.jetspeed.factory.PortletFactory; |
40 |
|
import org.apache.jetspeed.headerresource.HeaderResource; |
41 |
|
import org.apache.jetspeed.headerresource.HeaderResourceFactory; |
42 |
|
import org.apache.jetspeed.headerresource.HeaderResourceLib; |
43 |
|
import org.apache.jetspeed.om.common.portlet.PortletApplication; |
44 |
|
import org.apache.jetspeed.om.page.ContentFragment; |
45 |
|
import org.apache.jetspeed.om.page.ContentPage; |
46 |
|
import org.apache.jetspeed.portlet.PortletHeaderRequest; |
47 |
|
import org.apache.jetspeed.portlet.PortletHeaderResponse; |
48 |
|
import org.apache.jetspeed.portlet.SupportsHeaderPhase; |
49 |
|
import org.apache.jetspeed.request.RequestContext; |
50 |
|
import org.apache.jetspeed.PortalReservedParameters; |
51 |
|
import org.apache.pluto.om.portlet.PortletDefinition; |
52 |
|
import org.apache.pluto.om.window.PortletWindow; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
public class HeaderAggregatorImpl implements PageAggregator |
63 |
|
{ |
64 |
0 |
protected final static Log log = LogFactory.getLog( HeaderAggregatorImpl.class ); |
65 |
|
protected final static String EOL = "\r\n"; |
66 |
|
|
67 |
|
private PortletFactory factory; |
68 |
|
private PortletWindowAccessor windowAccessor; |
69 |
|
private HeaderResourceFactory headerResourceFactory; |
70 |
|
private DecorationFactory decorationFactory; |
71 |
|
|
72 |
|
private boolean isDesktop; |
73 |
|
|
74 |
|
private Map headerConfiguration; |
75 |
|
private Map headerResourceRegistry; |
76 |
|
private Map headerDynamicConfigurationDefault; |
77 |
|
private Map headerNamedResourcesDefault; |
78 |
|
private Map headerNamedResourcesAddedFragmentsDefault; |
79 |
|
|
80 |
|
|
81 |
0 |
private BasePortalURL baseUrlAccess = null; |
82 |
|
|
83 |
|
|
84 |
|
public HeaderAggregatorImpl( PortletFactory factory, |
85 |
|
PortletWindowAccessor windowAccessor, |
86 |
|
HeaderResourceFactory headerResourceFactory, |
87 |
|
boolean isDesktop, |
88 |
|
Map headerConfiguration, |
89 |
|
Map headerResourceRegistry, |
90 |
|
DecorationFactory decorationFactory ) |
91 |
|
{ |
92 |
0 |
this( factory, windowAccessor, headerResourceFactory, isDesktop, headerConfiguration, headerResourceRegistry, decorationFactory, null ); |
93 |
0 |
} |
94 |
|
|
95 |
|
public HeaderAggregatorImpl( PortletFactory factory, |
96 |
|
PortletWindowAccessor windowAccessor, |
97 |
|
HeaderResourceFactory headerResourceFactory, |
98 |
|
boolean isDesktop, |
99 |
|
Map headerConfiguration, |
100 |
|
Map headerResourceRegistry, |
101 |
|
DecorationFactory decorationFactory, |
102 |
|
BasePortalURL baseUrlAccess ) |
103 |
0 |
{ |
104 |
0 |
this.factory = factory; |
105 |
0 |
this.windowAccessor = windowAccessor; |
106 |
0 |
this.headerResourceFactory = headerResourceFactory; |
107 |
0 |
this.isDesktop = isDesktop; |
108 |
0 |
this.baseUrlAccess = baseUrlAccess; |
109 |
0 |
this.decorationFactory = decorationFactory; |
110 |
0 |
initializeHeaderConfiguration( headerConfiguration, headerResourceRegistry ); |
111 |
0 |
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
private void initializeHeaderConfiguration( Map headerConfigArg, Map headerRsrcRegistryArg ) |
118 |
|
{ |
119 |
0 |
this.headerConfiguration = null; |
120 |
0 |
this.headerResourceRegistry = null; |
121 |
0 |
this.headerDynamicConfigurationDefault = null; |
122 |
0 |
this.headerNamedResourcesDefault = null; |
123 |
0 |
this.headerNamedResourcesAddedFragmentsDefault = null; |
124 |
|
|
125 |
0 |
if ( headerConfigArg != null && headerConfigArg.size() > 0 ) |
126 |
|
{ |
127 |
|
|
128 |
0 |
HashMap headerConfig = new HashMap(); |
129 |
0 |
Iterator headerConfigEntryIter = headerConfigArg.entrySet().iterator(); |
130 |
0 |
while ( headerConfigEntryIter.hasNext() ) |
131 |
|
{ |
132 |
0 |
Map.Entry headerConfigEntry = (Map.Entry)headerConfigEntryIter.next(); |
133 |
0 |
Object headerConfigKey = headerConfigEntry.getKey(); |
134 |
0 |
Object headerConfigVal = headerConfigEntry.getValue(); |
135 |
0 |
if ( headerConfigVal instanceof Map ) |
136 |
|
{ |
137 |
0 |
headerConfig.put( headerConfigKey, Collections.unmodifiableMap( new HashMap( (Map)headerConfigVal ) ) ); |
138 |
|
} |
139 |
0 |
else if ( headerConfigVal instanceof List ) |
140 |
|
{ |
141 |
0 |
headerConfig.put( headerConfigKey, Collections.unmodifiableList( new ArrayList( (List)headerConfigVal ) ) ); |
142 |
|
} |
143 |
|
else |
144 |
|
{ |
145 |
0 |
headerConfig.put( headerConfigKey, headerConfigVal ); |
146 |
|
} |
147 |
0 |
} |
148 |
0 |
this.headerConfiguration = Collections.unmodifiableMap( headerConfig ); |
149 |
|
|
150 |
|
|
151 |
0 |
Map headerRsrcRegistry = null; |
152 |
0 |
if ( headerRsrcRegistryArg != null && headerRsrcRegistryArg.size() > 0 ) |
153 |
|
{ |
154 |
0 |
headerRsrcRegistry = new HashMap( headerRsrcRegistryArg ); |
155 |
|
|
156 |
|
|
157 |
|
} |
158 |
|
else |
159 |
|
{ |
160 |
0 |
headerRsrcRegistry = new HashMap(); |
161 |
|
} |
162 |
0 |
this.headerResourceRegistry = headerRsrcRegistry; |
163 |
|
|
164 |
0 |
HashMap namedResourcesDefault = new HashMap(); |
165 |
0 |
HashMap namedResourcesAddedFragmentsDefault = new HashMap(); |
166 |
|
|
167 |
0 |
Map dynamicConfigurationDefault = initializeHeaderConfigurationDefaults( namedResourcesDefault, namedResourcesAddedFragmentsDefault ); |
168 |
0 |
if ( dynamicConfigurationDefault != null ) |
169 |
0 |
this.headerDynamicConfigurationDefault = Collections.unmodifiableMap( dynamicConfigurationDefault ); |
170 |
|
|
171 |
0 |
this.headerNamedResourcesDefault = Collections.unmodifiableMap( namedResourcesDefault ); |
172 |
0 |
this.headerNamedResourcesAddedFragmentsDefault = Collections.unmodifiableMap( namedResourcesAddedFragmentsDefault ); |
173 |
|
|
174 |
0 |
this.headerResourceRegistry = null; |
175 |
0 |
if ( headerRsrcRegistry != null && headerRsrcRegistry.size() > 0 ) |
176 |
|
{ |
177 |
0 |
this.headerResourceRegistry = Collections.unmodifiableMap( headerRsrcRegistry ); |
178 |
|
} |
179 |
|
} |
180 |
0 |
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
protected Map initializeHeaderConfigurationDefaults( HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault ) |
198 |
|
{ |
199 |
0 |
if ( this.headerConfiguration == null ) |
200 |
|
{ |
201 |
0 |
return null; |
202 |
|
} |
203 |
|
|
204 |
0 |
HashMap headerDynamicConfigurationDefault = new HashMap(); |
205 |
|
|
206 |
0 |
initializeHeaderOrderConfigurationDefaults( namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
207 |
|
|
208 |
|
|
209 |
0 |
setNamedHeaderResourceProperties( HeaderResource.HEADER_SECTION_BASE_TAG, HeaderResource.HEADER_TYPE_BASE_TAG, null, headerDynamicConfigurationDefault ); |
210 |
|
|
211 |
0 |
Iterator hConfigEntryIter = this.headerConfiguration.entrySet().iterator(); |
212 |
0 |
while ( hConfigEntryIter.hasNext() ) |
213 |
|
{ |
214 |
0 |
Map.Entry hConfigEntry = (Map.Entry)hConfigEntryIter.next(); |
215 |
0 |
Object hConfigKey = hConfigEntry.getKey(); |
216 |
0 |
Object hConfigVal = hConfigEntry.getValue(); |
217 |
|
|
218 |
0 |
if ( ! initializeHeaderConfigurationEntryDefaults( hConfigKey, hConfigVal, namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ) ) |
219 |
|
{ |
220 |
0 |
if ( hConfigVal instanceof Map ) |
221 |
|
{ |
222 |
0 |
headerDynamicConfigurationDefault.put( hConfigKey, Collections.unmodifiableMap( new HashMap( (Map)hConfigVal ) ) ); |
223 |
|
} |
224 |
0 |
else if ( hConfigVal instanceof List ) |
225 |
|
{ |
226 |
0 |
headerDynamicConfigurationDefault.put( hConfigKey, Collections.unmodifiableList( new ArrayList( (List)hConfigVal ) ) ); |
227 |
|
} |
228 |
|
else |
229 |
|
{ |
230 |
0 |
headerDynamicConfigurationDefault.put( hConfigKey, hConfigVal ); |
231 |
|
} |
232 |
|
} |
233 |
0 |
} |
234 |
0 |
initializeMissingHeaderConfigurationEntryDefaults( namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
235 |
|
|
236 |
0 |
postinitializeHeaderOrderConfigurationDefaults( headerDynamicConfigurationDefault ); |
237 |
|
|
238 |
0 |
return headerDynamicConfigurationDefault; |
239 |
|
} |
240 |
|
|
241 |
|
protected void initializeHeaderOrderConfigurationDefaults( HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault, HashMap headerDynamicConfigurationDefault ) |
242 |
|
{ |
243 |
0 |
if ( this.headerConfiguration != null ) |
244 |
|
{ |
245 |
0 |
List headerOrderConfigList = (List)this.headerConfiguration.get( HeaderResource.HEADER_CONFIG_ORDER ); |
246 |
0 |
if ( headerOrderConfigList != null && headerOrderConfigList.size() > 0 ) |
247 |
|
{ |
248 |
0 |
ArrayList headerOrderList = new ArrayList(); |
249 |
0 |
Map headerNames = new HashMap(); |
250 |
0 |
Iterator headerOrderListIter = headerOrderConfigList.iterator(); |
251 |
0 |
while ( headerOrderListIter.hasNext() ) |
252 |
|
{ |
253 |
0 |
Object headerNameObj = headerOrderListIter.next(); |
254 |
0 |
if ( headerNameObj != null ) |
255 |
|
{ |
256 |
0 |
String headerName = headerNameObj.toString(); |
257 |
0 |
if ( headerName != null && headerName.length() > 0 ) |
258 |
|
{ |
259 |
0 |
headerOrderList.add( headerName ); |
260 |
0 |
headerNames.put( headerName, Boolean.TRUE ); |
261 |
|
} |
262 |
|
} |
263 |
0 |
} |
264 |
|
|
265 |
|
|
266 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_ORDER, headerOrderList ); |
267 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_INTERNAL_INCLUDED_NAMES, headerNames ); |
268 |
|
} |
269 |
|
|
270 |
0 |
Map headerTypes = null; |
271 |
0 |
Map headerTypesConfig = (Map)this.headerConfiguration.get( HeaderResource.HEADER_CONFIG_TYPES ); |
272 |
0 |
if ( headerTypesConfig != null && headerTypesConfig.size() > 0 ) |
273 |
|
{ |
274 |
0 |
headerTypes = new HashMap(); |
275 |
0 |
Iterator headerTypesConfigIter = headerTypesConfig.entrySet().iterator(); |
276 |
0 |
while ( headerTypesConfigIter.hasNext() ) |
277 |
|
{ |
278 |
0 |
Map.Entry headerTypeEntry = (Map.Entry)headerTypesConfigIter.next(); |
279 |
0 |
Object headerNameObj = headerTypeEntry.getKey(); |
280 |
0 |
Object headerTypeObj = headerTypeEntry.getValue(); |
281 |
0 |
if ( headerNameObj != null && headerTypeObj != class="keyword">null ) |
282 |
|
{ |
283 |
0 |
String headerName = headerNameObj.toString(); |
284 |
0 |
int headerTypeId = HeaderResourceLib.getHeaderTypeId( headerTypeObj.toString() ); |
285 |
0 |
if ( headerName != null ) |
286 |
|
{ |
287 |
0 |
if ( headerTypeId >= 0 ) |
288 |
|
{ |
289 |
0 |
headerTypes.put( headerName, new Object[] { class="keyword">new Integer( headerTypeId ), null } ); |
290 |
|
} |
291 |
|
else |
292 |
|
{ |
293 |
0 |
log.error( "HeaderAggregatorImpl.initializeHeaderOrderConfigurationDefaults() ignoring specification of unknown header section type; header-section-name=" + headerName + " header-section-type=" + headerTypeObj.toString() ); |
294 |
|
} |
295 |
|
} |
296 |
|
} |
297 |
0 |
} |
298 |
|
} |
299 |
|
|
300 |
0 |
Map headerRequiredFlagConfig = (Map)this.headerConfiguration.get( HeaderResource.HEADER_CONFIG_REQUIREDFLAG ); |
301 |
0 |
if ( headerRequiredFlagConfig != null && headerRequiredFlagConfig.size() > 0 ) |
302 |
|
{ |
303 |
0 |
if ( headerTypes == null ) |
304 |
|
{ |
305 |
0 |
headerTypes = new HashMap(); |
306 |
|
} |
307 |
0 |
Iterator headerRequiredFlagConfigIter = headerRequiredFlagConfig.entrySet().iterator(); |
308 |
0 |
while ( headerRequiredFlagConfigIter.hasNext() ) |
309 |
|
{ |
310 |
0 |
Map.Entry headerRequiredFlagEntry = (Map.Entry)headerRequiredFlagConfigIter.next(); |
311 |
0 |
Object headerNameObj = headerRequiredFlagEntry.getKey(); |
312 |
0 |
Object headerReqFlagObj = headerRequiredFlagEntry.getValue(); |
313 |
0 |
if ( headerNameObj != null && headerReqFlagObj != class="keyword">null ) |
314 |
|
{ |
315 |
0 |
String headerName = headerNameObj.toString(); |
316 |
0 |
String headerReqFlag = headerReqFlagObj.toString(); |
317 |
0 |
if ( headerName != null && headerName.length() > 0 && headerReqFlag != class="keyword">null ) |
318 |
|
{ |
319 |
0 |
Object[] headerTypePair = (Object[])headerTypes.get( headerName ); |
320 |
0 |
if ( headerTypePair != null ) |
321 |
|
{ |
322 |
0 |
headerTypePair[1] = headerReqFlag; |
323 |
|
} |
324 |
|
else |
325 |
|
{ |
326 |
0 |
headerTypePair = new Object[] { null, headerReqFlag }; |
327 |
0 |
headerTypes.put( headerName, headerTypePair ); |
328 |
|
} |
329 |
|
} |
330 |
|
} |
331 |
0 |
} |
332 |
|
} |
333 |
0 |
if ( headerTypes != null && headerTypes.size() > 0 ) |
334 |
|
{ |
335 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_TYPES, headerTypes ); |
336 |
|
} |
337 |
|
} |
338 |
0 |
} |
339 |
|
protected void postinitializeHeaderOrderConfigurationDefaults( HashMap headerDynamicConfigurationDefault ) |
340 |
|
{ |
341 |
0 |
if ( headerDynamicConfigurationDefault != null ) |
342 |
|
{ |
343 |
0 |
Map headerNames = (Map)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_INTERNAL_INCLUDED_NAMES ); |
344 |
0 |
if ( headerNames != null ) |
345 |
|
{ |
346 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_INTERNAL_INCLUDED_NAMES, Collections.unmodifiableMap( headerNames ) ); |
347 |
|
} |
348 |
0 |
Map headerTypes = (Map)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_CONFIG_TYPES ); |
349 |
0 |
if ( headerTypes != null ) |
350 |
|
{ |
351 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_TYPES, Collections.unmodifiableMap( headerTypes ) ); |
352 |
|
} |
353 |
0 |
List headerOrderList = (List)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_CONFIG_ORDER ); |
354 |
0 |
if ( headerOrderList != null ) |
355 |
|
{ |
356 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_ORDER, Collections.unmodifiableList( headerOrderList ) ); |
357 |
|
} |
358 |
|
} |
359 |
0 |
} |
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
protected boolean initializeHeaderConfigurationEntryDefaults( Object headerConfigKey, Object headerConfigValue, HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault, HashMap headerDynamicConfigurationDefault ) |
367 |
|
{ |
368 |
0 |
if ( headerConfigKey.equals( HeaderResource.HEADER_CONFIG_ORDER ) || headerConfigKey.equals( HeaderResource.HEADER_CONFIG_TYPES ) || headerConfigKey.equals( HeaderResource.HEADER_CONFIG_REQUIREDFLAG ) ) |
369 |
|
{ |
370 |
|
|
371 |
0 |
return true; |
372 |
|
} |
373 |
0 |
else if ( headerConfigKey.equals( HeaderResource.HEADER_CONFIG_DOJO ) ) |
374 |
|
{ |
375 |
0 |
initializeDojoHeaderConfigurationDefaults( (Map)headerConfigValue, namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
376 |
0 |
return true; |
377 |
|
} |
378 |
0 |
else if ( headerConfigKey.equals( HeaderResource.HEADER_CONFIG_DESKTOP ) ) |
379 |
|
{ |
380 |
0 |
initializeDesktopHeaderConfigurationDefaults( (Map)headerConfigValue, namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
381 |
0 |
return true; |
382 |
|
} |
383 |
0 |
return false; |
384 |
|
} |
385 |
|
|
386 |
|
protected void initializeMissingHeaderConfigurationEntryDefaults( HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault, HashMap headerDynamicConfigurationDefault ) |
387 |
|
{ |
388 |
0 |
if ( isDesktop() ) |
389 |
|
{ |
390 |
0 |
if ( this.headerConfiguration.get( HeaderResource.HEADER_CONFIG_DOJO ) == null ) |
391 |
|
{ |
392 |
0 |
initializeDojoHeaderConfigurationDefaults( null, namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
393 |
|
} |
394 |
0 |
if ( this.headerConfiguration.get( HeaderResource.HEADER_CONFIG_DESKTOP ) == null ) |
395 |
|
{ |
396 |
0 |
initializeDesktopHeaderConfigurationDefaults( null, namedResourcesDefault, namedResourcesAddedFragmentsDefault, headerDynamicConfigurationDefault ); |
397 |
|
} |
398 |
|
} |
399 |
0 |
} |
400 |
|
|
401 |
|
protected void registerAndOrderNamedHeaderResource( String headerName, String headerType, String headerReqFlag, Map headerDynamicConfigurationDefault ) |
402 |
|
{ |
403 |
0 |
orderNamedHeaderResource( headerName, headerDynamicConfigurationDefault ); |
404 |
0 |
setNamedHeaderResourceProperties( headerName, headerType, headerReqFlag, headerDynamicConfigurationDefault ); |
405 |
0 |
} |
406 |
|
|
407 |
|
protected void orderNamedHeaderResource( String headerName, Map headerDynamicConfigurationDefault ) |
408 |
|
{ |
409 |
0 |
if ( headerName != null ) |
410 |
|
{ |
411 |
0 |
Map headerNames = (Map)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_INTERNAL_INCLUDED_NAMES ); |
412 |
0 |
if ( headerNames == null ) |
413 |
|
{ |
414 |
0 |
headerNames = new HashMap(); |
415 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_INTERNAL_INCLUDED_NAMES, headerNames ); |
416 |
|
} |
417 |
|
|
418 |
0 |
Object headerNamesVal = headerNames.get( headerName ); |
419 |
0 |
if ( headerNamesVal == null ) |
420 |
|
{ |
421 |
0 |
List headerOrderList = (List)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_CONFIG_ORDER ); |
422 |
0 |
if ( headerOrderList == null ) |
423 |
|
{ |
424 |
0 |
headerOrderList = new ArrayList(); |
425 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_ORDER, headerOrderList ); |
426 |
|
} |
427 |
|
|
428 |
0 |
headerOrderList.add( headerName ); |
429 |
0 |
headerNames.put( headerName, Boolean.TRUE ); |
430 |
|
} |
431 |
|
} |
432 |
0 |
} |
433 |
|
|
434 |
|
protected void setNamedHeaderResourceProperties( String headerName, String headerType, String headerReqFlag, Map headerDynamicConfigurationDefault ) |
435 |
|
{ |
436 |
0 |
if ( headerName != null ) |
437 |
|
{ |
438 |
0 |
int headerTypeId = HeaderResourceLib.getHeaderTypeId( headerType ); |
439 |
|
|
440 |
0 |
boolean headerRefFlagSpecified = ( headerReqFlag != null && headerReqFlag.length() > 0 ); |
441 |
0 |
if ( headerTypeId < 0 && ! headerRefFlagSpecclass="keyword">ified ) |
442 |
|
{ |
443 |
0 |
log.error( "HeaderAggregatorImpl.registerAndOrderNamedHeaderResource() ignoring specification of unknown header section type; header-section-name=" + headerName + " header-section-type=" + headerType ); |
444 |
|
} |
445 |
|
|
446 |
0 |
if ( ( headerTypeId >= 0 ) || headerRefFlagSpecclass="keyword">ified ) |
447 |
|
{ |
448 |
0 |
Map headerTypes = (Map)headerDynamicConfigurationDefault.get( HeaderResource.HEADER_CONFIG_TYPES ); |
449 |
0 |
if ( headerTypes == null ) |
450 |
|
{ |
451 |
0 |
headerTypes = new HashMap(); |
452 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_TYPES, headerTypes ); |
453 |
|
} |
454 |
|
|
455 |
0 |
Object[] headerTypePair = (Object[])headerTypes.get( headerName ); |
456 |
0 |
if ( headerTypePair == null ) |
457 |
|
{ |
458 |
0 |
headerTypePair = new Object[] { null, class="keyword">null }; |
459 |
0 |
headerTypes.put( headerName, headerTypePair ); |
460 |
|
} |
461 |
0 |
if ( headerTypePair[0] == null && headerTypeId >= 0 ) |
462 |
|
{ |
463 |
0 |
headerTypePair[0] = new Integer( headerTypeId ); |
464 |
|
} |
465 |
0 |
if ( headerTypePair[1] == null && headerReqFlag != class="keyword">null && headerReqFlag.length() > 0 ) |
466 |
|
{ |
467 |
0 |
headerTypePair[1] = headerReqFlag; |
468 |
|
} |
469 |
|
} |
470 |
|
} |
471 |
0 |
} |
472 |
|
|
473 |
|
protected boolean canAddHeaderNamedResourceFragment( String headerFragmentName, HashMap namedResourcesAddedFragmentsDefault, String[] registryContent ) |
474 |
|
{ |
475 |
0 |
if ( headerFragmentName != null && ! namedResourcesAddedFragmentsDefault.containsKey( headerFragmentName ) ) |
476 |
|
{ |
477 |
0 |
namedResourcesAddedFragmentsDefault.put( headerFragmentName, Boolean.TRUE ); |
478 |
0 |
if ( registryContent != null ) |
479 |
|
{ |
480 |
0 |
String registryContentVal = (String)this.headerResourceRegistry.get( headerFragmentName ); |
481 |
0 |
registryContent[0] = registryContentVal; |
482 |
0 |
if ( registryContentVal != null ) |
483 |
|
{ |
484 |
0 |
this.headerResourceRegistry.remove( headerFragmentName ); |
485 |
|
} |
486 |
|
} |
487 |
0 |
return true; |
488 |
|
} |
489 |
0 |
if ( registryContent != null ) |
490 |
|
{ |
491 |
0 |
registryContent[0] = null; |
492 |
|
} |
493 |
0 |
return false; |
494 |
|
} |
495 |
|
|
496 |
|
protected void initializeDesktopHeaderConfigurationDefaults( Map desktopConfigMap, HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault, HashMap headerDynamicConfigurationDefault ) |
497 |
|
{ |
498 |
0 |
if ( desktopConfigMap == null ) |
499 |
|
{ |
500 |
0 |
desktopConfigMap = new HashMap(); |
501 |
|
} |
502 |
|
|
503 |
0 |
StringBuffer desktopDojoConfigContent = new StringBuffer(); |
504 |
|
|
505 |
0 |
String layoutDecorationDefaultName = HeaderResource.HEADER_CONFIG_DESKTOP_LAYOUT_DECORATION_DEFAULT; |
506 |
0 |
String layoutDecoration = (String)desktopConfigMap.get( layoutDecorationDefaultName ); |
507 |
0 |
if ( layoutDecoration != null && layoutDecoration.length() > 0 ) |
508 |
|
{ |
509 |
0 |
decorationFactory.setDefaultDesktopLayoutDecoration( layoutDecoration ); |
510 |
|
} |
511 |
|
|
512 |
0 |
String portletDecorationDefaultName = HeaderResource.HEADER_CONFIG_DESKTOP_PORTLET_DECORATION_DEFAULT; |
513 |
0 |
String portletDecoration = (String)desktopConfigMap.get( portletDecorationDefaultName ); |
514 |
0 |
if ( portletDecoration == null || portletDecoration.length() == 0 ) |
515 |
|
{ |
516 |
0 |
portletDecoration = decorationFactory.getDefaultDesktopPortletDecoration(); |
517 |
|
} |
518 |
0 |
if ( portletDecoration != null && portletDecoration.length() > 0 ) |
519 |
|
{ |
520 |
0 |
if ( canAddHeaderNamedResourceFragment( portletDecorationDefaultName, namedResourcesAddedFragmentsDefault, null ) ) |
521 |
|
{ |
522 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".windowDecoration = \"" ).append( portletDecoration ).append( "\"" ).append( EOL ); |
523 |
|
} |
524 |
0 |
decorationFactory.setDefaultDesktopPortletDecoration( portletDecoration ); |
525 |
|
} |
526 |
|
|
527 |
0 |
String desktopPageAjaxNavName = HeaderResource.HEADER_CONFIG_DESKTOP_PAGE_AJAXNAVIGATION; |
528 |
0 |
String desktopPageAjaxNav = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( desktopPageAjaxNavName ) ); |
529 |
0 |
if ( desktopPageAjaxNav != null && canAddHeaderNamedResourceFragment( desktopPageAjaxNavName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
530 |
|
{ |
531 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".ajaxPageNavigation = " ).append( desktopPageAjaxNav ).append( ";" ).append( EOL ); |
532 |
|
} |
533 |
|
|
534 |
0 |
String desktopWindowTilingName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_TILING; |
535 |
0 |
String desktopWindowTiling = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( desktopWindowTilingName ) ); |
536 |
0 |
if ( desktopWindowTiling != null && canAddHeaderNamedResourceFragment( desktopWindowTilingName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
537 |
|
{ |
538 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".windowTiling = " ).append( desktopWindowTiling ).append( ";" ).append( EOL ); |
539 |
|
} |
540 |
|
|
541 |
0 |
String desktopWindowHeightExpandName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT_EXPAND; |
542 |
0 |
String desktopWindowHeightExpand = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( desktopWindowHeightExpandName ) ); |
543 |
0 |
if ( desktopWindowHeightExpand != null && canAddHeaderNamedResourceFragment( desktopWindowHeightExpandName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
544 |
|
{ |
545 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".windowHeightExpand = " ).append( desktopWindowHeightExpand ).append( ";" ).append( EOL ); |
546 |
|
} |
547 |
|
|
548 |
0 |
String desktopWindowHeightName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT; |
549 |
0 |
String desktopWindowHeight = HeaderResourceLib.makeJSONInteger( desktopConfigMap.get( desktopWindowHeightName ), true ); |
550 |
0 |
if ( desktopWindowHeight != null && canAddHeaderNamedResourceFragment( desktopWindowHeightName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
551 |
|
{ |
552 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".windowHeight = " ).append( desktopWindowHeight ).append( ";" ).append( EOL ); |
553 |
|
} |
554 |
|
|
555 |
0 |
String desktopWindowWidthName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_WIDTH; |
556 |
0 |
String desktopWindowWidth = HeaderResourceLib.makeJSONInteger( desktopConfigMap.get( desktopWindowWidthName ), true ); |
557 |
0 |
if ( desktopWindowWidth != null && canAddHeaderNamedResourceFragment( desktopWindowWidthName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
558 |
|
{ |
559 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".windowWidth = " ).append( desktopWindowWidth ).append( ";" ).append( EOL ); |
560 |
|
} |
561 |
|
|
562 |
0 |
List actionList = new ArrayList(); |
563 |
|
|
564 |
0 |
String windowActionButtonOrderName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_ORDER; |
565 |
0 |
String actionButtonOrderContent = HeaderResourceLib.makeJSONStringArray( (List)desktopConfigMap.get( windowActionButtonOrderName ), actionList ); |
566 |
0 |
if ( actionButtonOrderContent != null && actionButtonOrderContent.length() > 0 ) |
567 |
|
{ |
568 |
0 |
if ( canAddHeaderNamedResourceFragment( windowActionButtonOrderName, namedResourcesAddedFragmentsDefault, null ) ) |
569 |
|
{ |
570 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_ORDER ).append( " = " ).append( actionButtonOrderContent ).append( ";" ).append( EOL ); |
571 |
|
} |
572 |
|
} |
573 |
|
|
574 |
0 |
String windowActionNoImageName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_NOIMAGE; |
575 |
0 |
String actionNoImageContent = HeaderResourceLib.makeJSONStringArray( (List)desktopConfigMap.get( windowActionNoImageName ), actionList ); |
576 |
0 |
if ( actionNoImageContent != null && actionNoImageContent.length() > 0 ) |
577 |
|
{ |
578 |
0 |
if ( canAddHeaderNamedResourceFragment( windowActionNoImageName, namedResourcesAddedFragmentsDefault, null ) ) |
579 |
|
{ |
580 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_NOIMAGE ).append( " = " ).append( actionNoImageContent ).append( ";" ).append( EOL ); |
581 |
|
} |
582 |
|
} |
583 |
|
|
584 |
0 |
String windowActionMenuOrderName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_MENU_ORDER; |
585 |
0 |
String actionMenuOrderContent = HeaderResourceLib.makeJSONStringArray( (List)desktopConfigMap.get( windowActionMenuOrderName ), actionList ); |
586 |
0 |
if ( actionMenuOrderContent != null && actionMenuOrderContent.length() > 0 ) |
587 |
|
{ |
588 |
0 |
if ( canAddHeaderNamedResourceFragment( windowActionMenuOrderName, namedResourcesAddedFragmentsDefault, null ) ) |
589 |
|
{ |
590 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_MENU_ORDER ).append( " = " ).append( actionMenuOrderContent ).append( ";" ).append( EOL ); |
591 |
|
} |
592 |
|
} |
593 |
|
|
594 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_INTERNAL_CONFIG_DESKTOP_WINDOW_ACTION, actionList ); |
595 |
|
|
596 |
0 |
String windowActionButtonTooltipName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_TOOLTIP; |
597 |
0 |
String windowActionButtonTooltip = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( windowActionButtonTooltipName ) ); |
598 |
0 |
if ( windowActionButtonTooltip != null && canAddHeaderNamedResourceFragment( windowActionButtonTooltipName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
599 |
|
{ |
600 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_TOOLTIP ).append( " = " ).append( windowActionButtonTooltip ).append( ";" ).append( EOL ); |
601 |
|
} |
602 |
|
|
603 |
0 |
String windowActionButtonMaxName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_MAX; |
604 |
0 |
String windowActionButtonMax = HeaderResourceLib.makeJSONInteger( desktopConfigMap.get( windowActionButtonMaxName ), false ); |
605 |
0 |
if ( windowActionButtonMax != null && canAddHeaderNamedResourceFragment( windowActionButtonMaxName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
606 |
|
{ |
607 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_MAX ).append( " = " ).append( windowActionButtonMax ).append( ";" ).append( EOL ); |
608 |
|
} |
609 |
|
|
610 |
0 |
String windowIconEnabledName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ICON_ENABLED; |
611 |
0 |
String iconEnabledContent = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( windowIconEnabledName ) ); |
612 |
0 |
if ( iconEnabledContent != null && iconEnabledContent.length() > 0 ) |
613 |
|
{ |
614 |
0 |
if ( canAddHeaderNamedResourceFragment( windowIconEnabledName, namedResourcesAddedFragmentsDefault, null ) ) |
615 |
|
{ |
616 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ICON_ENABLED ).append( " = " ).append( iconEnabledContent ).append( ";" ).append( EOL ); |
617 |
|
} |
618 |
|
} |
619 |
|
|
620 |
0 |
String windowIconPathName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ICON_PATH; |
621 |
0 |
String iconPathContent = (String)desktopConfigMap.get( windowIconPathName ); |
622 |
0 |
if ( iconPathContent != null && iconPathContent.length() > 0 ) |
623 |
|
{ |
624 |
0 |
if ( canAddHeaderNamedResourceFragment( windowIconPathName, namedResourcesAddedFragmentsDefault, null ) ) |
625 |
|
{ |
626 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_ICON_PATH ).append( " = \"" ).append( iconPathContent ).append( "\"" ).append( EOL ); |
627 |
|
} |
628 |
|
} |
629 |
|
|
630 |
0 |
String windowTitlebarEnabledName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_TITLEBAR_ENABLED; |
631 |
0 |
String titlebarEnabledContent = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( windowTitlebarEnabledName ) ); |
632 |
0 |
if ( titlebarEnabledContent != null && titlebarEnabledContent.length() > 0 ) |
633 |
|
{ |
634 |
0 |
if ( canAddHeaderNamedResourceFragment( windowTitlebarEnabledName, namedResourcesAddedFragmentsDefault, null ) ) |
635 |
|
{ |
636 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_TITLEBAR_ENABLED ).append( " = " ).append( titlebarEnabledContent ).append( ";" ).append( EOL ); |
637 |
|
} |
638 |
|
} |
639 |
|
|
640 |
0 |
String windowResizebarEnabledName = HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_RESIZEBAR_ENABLED; |
641 |
0 |
String resizebarEnabledContent = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( windowResizebarEnabledName ) ); |
642 |
0 |
if ( resizebarEnabledContent != null && resizebarEnabledContent.length() > 0 ) |
643 |
|
{ |
644 |
0 |
if ( canAddHeaderNamedResourceFragment( windowResizebarEnabledName, namedResourcesAddedFragmentsDefault, null ) ) |
645 |
|
{ |
646 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE ).append( HeaderResource.DESKTOP_JSON_WINDOW_TITLEBAR_ENABLED ).append( " = " ).append( resizebarEnabledContent ).append( ";" ).append( EOL ); |
647 |
|
} |
648 |
|
} |
649 |
|
|
650 |
0 |
String pageActionButtonTooltipName = HeaderResource.HEADER_CONFIG_DESKTOP_PAGE_ACTION_BUTTON_TOOLTIP; |
651 |
0 |
String pageActionButtonTooltip = HeaderResourceLib.makeJSONBoolean( desktopConfigMap.get( pageActionButtonTooltipName ) ); |
652 |
0 |
if ( pageActionButtonTooltip != null && canAddHeaderNamedResourceFragment( pageActionButtonTooltipName, namedResourcesAddedFragmentsDefault, class="keyword">null ) ) |
653 |
|
{ |
654 |
0 |
desktopDojoConfigContent.append( " " ).append( HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME ).append( ".pageActionButtonTooltip = " ).append( pageActionButtonTooltip ).append( ";" ).append( EOL ); |
655 |
|
} |
656 |
|
|
657 |
0 |
if ( desktopDojoConfigContent.length() > 0 ) |
658 |
|
{ |
659 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_CONFIG, desktopDojoConfigContent.toString() ); |
660 |
|
} |
661 |
|
|
662 |
0 |
StringBuffer desktopInitScript = new StringBuffer(); |
663 |
0 |
desktopInitScript.append( " function doRender(bindArgs,portletEntityId) { " ); |
664 |
0 |
desktopInitScript.append( "jetspeed.doRender(bindArgs,portletEntityId); }" ).append( EOL ); |
665 |
0 |
desktopInitScript.append( " function doAction(bindArgs,portletEntityId) { " ); |
666 |
0 |
desktopInitScript.append( "jetspeed.doAction(bindArgs,portletEntityId); }" ).append( EOL ); |
667 |
0 |
desktopInitScript.append( " dojo.addOnLoad( jetspeed.initializeDesktop );" ).append( EOL ); |
668 |
0 |
if ( canAddHeaderNamedResourceFragment( "desktop.init", namedResourcesAddedFragmentsDefault, null ) ) |
669 |
|
{ |
670 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DESKTOP_INIT, desktopInitScript.toString() ); |
671 |
0 |
setNamedHeaderResourceProperties( HeaderResource.HEADER_SECTION_DESKTOP_INIT, HeaderResource.HEADER_TYPE_SCRIPT_BLOCK_START, null, headerDynamicConfigurationDefault ); |
672 |
|
} |
673 |
0 |
} |
674 |
|
|
675 |
|
|
676 |
|
|
677 |
|
|
678 |
|
protected void initializeDojoHeaderConfigurationDefaults( Map dojoConfigMap, HashMap namedResourcesDefault, HashMap namedResourcesAddedFragmentsDefault, HashMap headerDynamicConfigurationDefault ) |
679 |
|
{ |
680 |
0 |
if ( dojoConfigMap == null ) |
681 |
|
{ |
682 |
0 |
dojoConfigMap = new HashMap(); |
683 |
|
} |
684 |
0 |
String[] registryContent = new String[] { null }; |
685 |
|
|
686 |
|
|
687 |
0 |
String dojoEnableName = HeaderResource.HEADER_CONFIG_DOJO_ENABLE; |
688 |
0 |
Object dojoEnableObj = dojoConfigMap.get( dojoEnableName ); |
689 |
0 |
String dojoEnable = ( ( dojoEnableObj == null ) ? (String)class="keyword">null : dojoEnableObj.toString() ); |
690 |
0 |
if ( dojoEnable == null || ! dojoEnable.equals( "true" ) ) |
691 |
|
{ |
692 |
0 |
dojoEnable = "false"; |
693 |
|
} |
694 |
0 |
headerDynamicConfigurationDefault.put( dojoEnableName, dojoEnable ); |
695 |
0 |
String dojoPath = (String)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_PATH ); |
696 |
0 |
if ( dojoPath == null || dojoPath.length() == 0 ) |
697 |
|
{ |
698 |
0 |
dojoPath = "/javascript/dojo/"; |
699 |
|
} |
700 |
0 |
headerDynamicConfigurationDefault.put( HeaderResource.HEADER_CONFIG_DOJO_PATH, dojoPath ); |
701 |
|
|
702 |
|
|
703 |
0 |
boolean dojoDebugEnabled = false; |
704 |
0 |
String dojoParamDebug = (String)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_PARAM_ISDEBUG ); |
705 |
0 |
String dojoParamDebugAtAllCosts = null; |
706 |
0 |
if ( dojoParamDebug != null ) |
707 |
0 |
dojoParamDebug = dojoParamDebug.toLowerCase(); |
708 |
0 |
if ( dojoParamDebug == null || dojoParamDebug.length() == 0 || dojoParamDebug.equals( "false" ) ) |
709 |
|
{ |
710 |
0 |
dojoParamDebug = null; |
711 |
|
} |
712 |
0 |
else if ( dojoParamDebug.equals( "true" ) ) |
713 |
|
{ |
714 |
0 |
dojoDebugEnabled = true; |
715 |
0 |
dojoParamDebugAtAllCosts = (String)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_PARAM_DEBUGALLCOSTS ); |
716 |
0 |
if ( dojoParamDebugAtAllCosts != null ) |
717 |
|
{ |
718 |
0 |
dojoParamDebugAtAllCosts = dojoParamDebugAtAllCosts.toLowerCase(); |
719 |
0 |
if ( ! dojoParamDebugAtAllCosts.equals( "true") ) |
720 |
|
{ |
721 |
0 |
dojoParamDebugAtAllCosts = null; |
722 |
|
} |
723 |
|
} |
724 |
|
} |
725 |
|
|
726 |
0 |
String dojoParamPreventBackBtnFix = (String)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_PARAM_PREVENT_BACKBUTTON_FIX ); |
727 |
0 |
String dojoParams = (String)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_PARAMS ); |
728 |
0 |
if ( dojoParamDebug != null || dojoParamDebugAtAllCosts != class="keyword">null || dojoParamPreventBackBtnFix != class="keyword">null || dojoParams != class="keyword">null ) |
729 |
|
{ |
730 |
0 |
StringBuffer dojoConfigContent = new StringBuffer(); |
731 |
0 |
boolean addedMembers = false; |
732 |
0 |
if ( dojoParams != null && dojoParams.length() > 0 ) |
733 |
|
{ |
734 |
0 |
dojoConfigContent.append( dojoParams ); |
735 |
0 |
addedMembers = true; |
736 |
|
} |
737 |
0 |
if ( dojoParamDebug != null && dojoParamDebug.length() > 0 ) |
738 |
|
{ |
739 |
0 |
if ( addedMembers ) |
740 |
|
{ |
741 |
0 |
dojoConfigContent.append( ", " ); |
742 |
|
} |
743 |
0 |
dojoConfigContent.append( "isDebug: " ).append( dojoParamDebug ) ; |
744 |
0 |
addedMembers = true; |
745 |
|
} |
746 |
0 |
if ( dojoParamDebugAtAllCosts != null && dojoParamDebugAtAllCosts.length() > 0 ) |
747 |
|
{ |
748 |
0 |
if ( addedMembers ) |
749 |
|
{ |
750 |
0 |
dojoConfigContent.append( ", " ); |
751 |
|
} |
752 |
0 |
dojoConfigContent.append( "debugAtAllCosts: " ).append( dojoParamDebugAtAllCosts ) ; |
753 |
0 |
addedMembers = true; |
754 |
|
} |
755 |
0 |
if ( dojoParamPreventBackBtnFix != null && dojoParamPreventBackBtnFix.length() > 0 ) |
756 |
|
{ |
757 |
0 |
if ( addedMembers ) |
758 |
|
{ |
759 |
0 |
dojoConfigContent.append( ", " ); |
760 |
|
} |
761 |
0 |
dojoConfigContent.append( "preventBackButtonFix: " ).append( dojoParamPreventBackBtnFix ) ; |
762 |
0 |
addedMembers = true; |
763 |
|
} |
764 |
0 |
if ( addedMembers ) |
765 |
|
{ |
766 |
0 |
dojoConfigContent.append( ", " ); |
767 |
|
} |
768 |
0 |
dojoConfigContent.append( HeaderResource.HEADER_INTERNAL_JETSPEED_VAR_NAME ).append( ": {}" ) ; |
769 |
0 |
addedMembers = true; |
770 |
|
|
771 |
0 |
if ( canAddHeaderNamedResourceFragment( HeaderResource.HEADER_CONFIG_DOJO_PARAMS, namedResourcesAddedFragmentsDefault, registryContent ) ) |
772 |
|
{ |
773 |
0 |
String dojoParamContent = dojoConfigContent.toString(); |
774 |
0 |
if ( registryContent[0] != null ) |
775 |
|
{ |
776 |
0 |
dojoParamContent = registryContent[0]; |
777 |
|
} |
778 |
0 |
if ( dojoParamContent.length() > 0 ) |
779 |
|
{ |
780 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_PARAMETERS, ( " var djConfig = {" + dojoParamContent + "};" + EOL ) ); |
781 |
|
} |
782 |
|
} |
783 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_PARAMETERS, HeaderResource.HEADER_TYPE_SCRIPT_BLOCK_START, dojoEnableName, headerDynamicConfigurationDefault ); |
784 |
|
} |
785 |
|
|
786 |
|
|
787 |
|
|
788 |
|
|
789 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_PREINIT, null, dojoEnableName, headerDynamicConfigurationDefault ); |
790 |
|
|
791 |
|
|
792 |
|
|
793 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_CONFIG, null, dojoEnableName, headerDynamicConfigurationDefault ); |
794 |
|
|
795 |
|
|
796 |
|
|
797 |
|
|
798 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_INIT, HeaderResource.HEADER_TYPE_SCRIPT_TAG, dojoEnableName, headerDynamicConfigurationDefault ); |
799 |
|
|
800 |
|
|
801 |
0 |
List dojoRequiresCore = (List)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_REQUIRES_CORE ); |
802 |
0 |
if ( dojoRequiresCore != null && dojoRequiresCore.size() > 0 ) |
803 |
|
{ |
804 |
0 |
StringBuffer dojoRequiresContent = new StringBuffer(); |
805 |
0 |
Iterator dojoRequiresCoreIter = dojoRequiresCore.iterator(); |
806 |
0 |
while ( dojoRequiresCoreIter.hasNext() ) |
807 |
|
{ |
808 |
0 |
String dojoReq = (String)dojoRequiresCoreIter.next(); |
809 |
0 |
if ( dojoReq != null && dojoReq.length() > 0 ) |
810 |
|
{ |
811 |
0 |
if ( canAddHeaderNamedResourceFragment( dojoReq, namedResourcesAddedFragmentsDefault, registryContent ) ) |
812 |
|
{ |
813 |
0 |
if ( registryContent[0] != null ) |
814 |
|
{ |
815 |
0 |
String dojoReqFromRegistry = HeaderResourceLib.makeJavascriptStatement( registryContent[0], " ", true ); |
816 |
0 |
if ( dojoReqFromRegistry.length() > 0 ) |
817 |
|
{ |
818 |
0 |
dojoRequiresContent.append( registryContent[0] ); |
819 |
|
} |
820 |
0 |
} |
821 |
|
else |
822 |
|
{ |
823 |
0 |
dojoRequiresContent.append( " dojo.require(\"").append( dojoReq ).append( "\");" ).append( EOL ); |
824 |
|
} |
825 |
|
} |
826 |
|
} |
827 |
0 |
} |
828 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_REQUIRES_CORE, dojoRequiresContent.toString() ); |
829 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_REQUIRES_CORE, null, dojoEnableName, headerDynamicConfigurationDefault ); |
830 |
|
} |
831 |
|
|
832 |
|
|
833 |
0 |
List dojoModulesPath = (List)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_MODULES_PATH ); |
834 |
0 |
if ( dojoModulesPath != null && dojoModulesPath.size() > 0 ) |
835 |
|
{ |
836 |
0 |
StringBuffer dojoModulesPathContent = new StringBuffer(); |
837 |
0 |
boolean addedContent = false; |
838 |
0 |
Iterator dojoModulesPathIter = dojoModulesPath.iterator(); |
839 |
0 |
while ( dojoModulesPathIter.hasNext() ) |
840 |
|
{ |
841 |
0 |
String dojoModule = (String)dojoModulesPathIter.next(); |
842 |
0 |
if ( dojoModule != null && dojoModule.length() > 0 ) |
843 |
|
{ |
844 |
0 |
if ( canAddHeaderNamedResourceFragment( dojoModule, namedResourcesAddedFragmentsDefault, registryContent ) ) |
845 |
|
{ |
846 |
0 |
String dojoModuleContent = null; |
847 |
0 |
if ( registryContent[0] != null ) |
848 |
|
{ |
849 |
0 |
dojoModuleContent = registryContent[0]; |
850 |
|
} |
851 |
|
else |
852 |
|
{ |
853 |
0 |
dojoModuleContent = dojoModule; |
854 |
|
} |
855 |
0 |
dojoModuleContent = HeaderResourceLib.makeJavascriptStatement( dojoModuleContent, " ", true ); |
856 |
0 |
if ( dojoModuleContent.length() > 0 ) |
857 |
|
{ |
858 |
0 |
dojoModulesPathContent.append( dojoModuleContent ); |
859 |
0 |
addedContent = true; |
860 |
|
} |
861 |
|
} |
862 |
|
} |
863 |
0 |
} |
864 |
0 |
if ( addedContent ) |
865 |
|
{ |
866 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_MODULES_PATH, dojoModulesPathContent.toString() ); |
867 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_MODULES_PATH, null, dojoEnableName, headerDynamicConfigurationDefault ); |
868 |
|
} |
869 |
|
} |
870 |
|
|
871 |
|
|
872 |
0 |
List dojoModulesNamespace = (List)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_MODULES_NAMESPACE ); |
873 |
0 |
if ( dojoModulesNamespace != null && dojoModulesNamespace.size() > 0 ) |
874 |
|
{ |
875 |
0 |
StringBuffer dojoModulesNamespaceContent = new StringBuffer(); |
876 |
0 |
boolean addedContent = false; |
877 |
0 |
Iterator dojoModulesNamespaceIter = dojoModulesNamespace.iterator(); |
878 |
0 |
while ( dojoModulesNamespaceIter.hasNext() ) |
879 |
|
{ |
880 |
0 |
String dojoModuleWidget = (String)dojoModulesNamespaceIter.next(); |
881 |
0 |
if ( dojoModuleWidget != null && dojoModuleWidget.length() > 0 ) |
882 |
|
{ |
883 |
0 |
if ( canAddHeaderNamedResourceFragment( dojoModuleWidget, namedResourcesAddedFragmentsDefault, registryContent ) ) |
884 |
|
{ |
885 |
0 |
String dojoModuleContent = null; |
886 |
0 |
if ( registryContent[0] != null ) |
887 |
|
{ |
888 |
0 |
dojoModuleContent = registryContent[0]; |
889 |
|
} |
890 |
|
else |
891 |
|
{ |
892 |
0 |
dojoModuleContent = dojoModuleWidget; |
893 |
|
} |
894 |
0 |
dojoModuleContent = HeaderResourceLib.makeJavascriptStatement( dojoModuleContent, " ", true ); |
895 |
0 |
if ( dojoModuleContent.length() > 0 ) |
896 |
|
{ |
897 |
0 |
dojoModulesNamespaceContent.append( dojoModuleContent ); |
898 |
0 |
addedContent = true; |
899 |
|
} |
900 |
|
} |
901 |
|
} |
902 |
0 |
} |
903 |
0 |
if ( addedContent ) |
904 |
|
{ |
905 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_MODULES_NAMESPACE, dojoModulesNamespaceContent.toString() ); |
906 |
|
|
907 |
|
} |
908 |
|
} |
909 |
|
|
910 |
|
|
911 |
0 |
List dojoRequiresModules = (List)dojoConfigMap.get( HeaderResource.HEADER_CONFIG_DOJO_REQUIRES_MODULES ); |
912 |
0 |
if ( dojoRequiresModules != null && dojoRequiresModules.size() > 0 ) |
913 |
|
{ |
914 |
0 |
HashMap addedReqs = null; |
915 |
0 |
if ( dojoDebugEnabled ) |
916 |
0 |
addedReqs = new HashMap(); |
917 |
0 |
StringBuffer dojoRequiresContent = new StringBuffer(); |
918 |
0 |
Iterator dojoRequiresModulesIter = dojoRequiresModules.iterator(); |
919 |
0 |
while ( dojoRequiresModulesIter.hasNext() ) |
920 |
|
{ |
921 |
0 |
String dojoReq = (String)dojoRequiresModulesIter.next(); |
922 |
0 |
if ( dojoReq != null && dojoReq.length() > 0 ) |
923 |
|
{ |
924 |
0 |
if ( canAddHeaderNamedResourceFragment( dojoReq, namedResourcesAddedFragmentsDefault, registryContent ) ) |
925 |
|
{ |
926 |
0 |
if ( registryContent[0] != null ) |
927 |
|
{ |
928 |
0 |
String dojoReqFromRegistry = HeaderResourceLib.makeJavascriptStatement( registryContent[0], " ", true ); |
929 |
0 |
if ( dojoReqFromRegistry.length() > 0 ) |
930 |
|
{ |
931 |
0 |
dojoRequiresContent.append( registryContent[0] ); |
932 |
|
} |
933 |
0 |
} |
934 |
|
else |
935 |
|
{ |
936 |
0 |
dojoRequiresContent.append( " dojo.require(\"").append( dojoReq ).append( "\");" ).append( EOL ); |
937 |
0 |
if ( dojoDebugEnabled ) |
938 |
0 |
addedReqs.put( dojoReq, dojoReq ); |
939 |
|
} |
940 |
|
} |
941 |
|
} |
942 |
0 |
} |
943 |
0 |
if ( dojoDebugEnabled ) |
944 |
|
{ |
945 |
0 |
if ( addedReqs.get( HeaderResource.HEADER_DEBUG_REQUIRES ) == null ) |
946 |
|
{ |
947 |
0 |
dojoRequiresContent.append( " dojo.require(\"").append( HeaderResource.HEADER_DEBUG_REQUIRES ).append( "\");" ).append( EOL ); |
948 |
|
} |
949 |
|
} |
950 |
0 |
namedResourcesDefault.put( HeaderResource.HEADER_SECTION_DOJO_REQUIRES_MODULES, dojoRequiresContent.toString() ); |
951 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_REQUIRES_MODULES, null, dojoEnableName, headerDynamicConfigurationDefault ); |
952 |
|
} |
953 |
|
|
954 |
|
|
955 |
|
|
956 |
|
|
957 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_WRITEINCLUDES, HeaderResource.HEADER_TYPE_SCRIPT_BLOCK_START, dojoEnableName, headerDynamicConfigurationDefault ); |
958 |
|
|
959 |
|
|
960 |
|
|
961 |
0 |
registerAndOrderNamedHeaderResource( HeaderResource.HEADER_SECTION_DOJO_MODULES_NAMESPACE, HeaderResource.HEADER_TYPE_SCRIPT_BLOCK_START, dojoEnableName, headerDynamicConfigurationDefault ); |
962 |
|
|
963 |
|
|
964 |
0 |
setNamedHeaderResourceProperties( HeaderResource.HEADER_SECTION_DOJO_STYLE_BODYEXPAND, HeaderResource.HEADER_TYPE_STYLE_BLOCK, dojoEnableName, headerDynamicConfigurationDefault ); |
965 |
|
|
966 |
|
|
967 |
0 |
setNamedHeaderResourceProperties( HeaderResource.HEADER_SECTION_DOJO_STYLE_BODYEXPAND_NOSCROLL, HeaderResource.HEADER_TYPE_STYLE_BLOCK, dojoEnableName, headerDynamicConfigurationDefault ); |
968 |
0 |
} |
969 |
|
|
970 |
|
|
971 |
|
|
972 |
|
|
973 |
|
|
974 |
|
|
975 |
|
|
976 |
|
public void build( RequestContext context ) throws JetspeedException, IOException |
977 |
|
{ |
978 |
0 |
ContentPage page = context.getPage(); |
979 |
0 |
if ( null == page ) |
980 |
|
{ |
981 |
0 |
throw new JetspeedException( "Failed to find PSML Pin ContentPageAggregator.build" ); |
982 |
|
} |
983 |
|
|
984 |
0 |
ContentFragment root = page.getRootContentFragment(); |
985 |
|
|
986 |
0 |
if ( root == null ) |
987 |
|
{ |
988 |
0 |
throw new JetspeedException( "No root ContentFragment found in ContentPage" ); |
989 |
|
} |
990 |
|
|
991 |
|
|
992 |
0 |
Map dynamicConfigDefault = getHeaderDynamicConfigurationDefault(); |
993 |
0 |
Map namedResourcesDefault = getHeaderNamedResourcesDefault(); |
994 |
0 |
Map namedResourcesAddedFragmentsDefault = getHeaderNamedResourcesAddedFragmentsDefault(); |
995 |
|
|
996 |
|
|
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
|
|
1001 |
|
|
1002 |
|
|
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
0 |
if ( dynamicConfigDefault != null || namedResourcesDefault != class="keyword">null || namedResourcesAddedFragmentsDefault != class="keyword">null ) |
1008 |
|
{ |
1009 |
0 |
Map existingNamedResources = (Map)context.getAttribute( PortalReservedParameters.HEADER_NAMED_RESOURCE_ATTRIBUTE ); |
1010 |
0 |
if ( existingNamedResources == null ) |
1011 |
|
{ |
1012 |
0 |
if ( dynamicConfigDefault == null ) |
1013 |
|
{ |
1014 |
0 |
context.setAttribute( PortalReservedParameters.HEADER_CONFIGURATION_ATTRIBUTE, new HashMap() ); |
1015 |
|
} |
1016 |
|
else |
1017 |
|
{ |
1018 |
0 |
HashMap dynamicConfig = new HashMap(); |
1019 |
0 |
Iterator hConfigEntryIter = dynamicConfigDefault.entrySet().iterator(); |
1020 |
0 |
while ( hConfigEntryIter.hasNext() ) |
1021 |
|
{ |
1022 |
0 |
Map.Entry hConfigEntry = (Map.Entry)hConfigEntryIter.next(); |
1023 |
0 |
Object hConfigKey = hConfigEntry.getKey(); |
1024 |
0 |
Object hConfigVal = hConfigEntry.getValue(); |
1025 |
0 |
if ( hConfigVal instanceof Map ) |
1026 |
|
{ |
1027 |
0 |
dynamicConfig.put( hConfigKey, new HashMap( (Map)hConfigVal ) ); |
1028 |
|
} |
1029 |
0 |
else if ( hConfigVal instanceof List ) |
1030 |
|
{ |
1031 |
0 |
dynamicConfig.put( hConfigKey, new ArrayList( (List)hConfigVal ) ); |
1032 |
|
} |
1033 |
|
else |
1034 |
|
{ |
1035 |
0 |
dynamicConfig.put( hConfigKey, hConfigVal ); |
1036 |
|
} |
1037 |
0 |
} |
1038 |
0 |
context.setAttribute( PortalReservedParameters.HEADER_CONFIGURATION_ATTRIBUTE, dynamicConfig ); |
1039 |
|
} |
1040 |
|
|
1041 |
0 |
if ( namedResourcesDefault != null ) |
1042 |
|
{ |
1043 |
0 |
context.setAttribute( PortalReservedParameters.HEADER_NAMED_RESOURCE_ATTRIBUTE, new HashMap( namedResourcesDefault ) ); |
1044 |
|
} |
1045 |
0 |
if ( namedResourcesAddedFragmentsDefault != null ) |
1046 |
|
{ |
1047 |
0 |
context.setAttribute( PortalReservedParameters.HEADER_NAMED_RESOURCE_ADDED_FRAGMENTS_ATTRIBUTE, new HashMap( namedResourcesAddedFragmentsDefault ) ); |
1048 |
|
} |
1049 |
|
} |
1050 |
|
} |
1051 |
0 |
if ( getHeaderResourceRegistry() != null ) |
1052 |
|
{ |
1053 |
0 |
context.setAttribute( PortalReservedParameters.HEADER_NAMED_RESOURCE_REGISTRY_ATTRIBUTE, getHeaderResourceRegistry() ); |
1054 |
|
} |
1055 |
|
|
1056 |
|
|
1057 |
0 |
boolean atLeastOneHasHeaderPhase = false; |
1058 |
0 |
NavigationalState nav = context.getPortalURL().getNavigationalState(); |
1059 |
0 |
PortletWindow window = nav.getMaximizedWindow(); |
1060 |
0 |
if ( null != window ) |
1061 |
|
{ |
1062 |
0 |
ContentFragment maxedContentFragment = page.getContentFragmentById( window.getId().toString() ); |
1063 |
0 |
if ( maxedContentFragment != null ) |
1064 |
|
{ |
1065 |
0 |
atLeastOneHasHeaderPhase = renderHeaderFragment( context, maxedContentFragment ); |
1066 |
|
} |
1067 |
0 |
} |
1068 |
|
else |
1069 |
|
{ |
1070 |
0 |
atLeastOneHasHeaderPhase = aggregateAndRender( root, context, page ); |
1071 |
|
} |
1072 |
|
|
1073 |
0 |
if ( atLeastOneHasHeaderPhase ) |
1074 |
|
{ |
1075 |
|
|
1076 |
|
} |
1077 |
0 |
} |
1078 |
|
|
1079 |
|
protected boolean aggregateAndRender( ContentFragment fragment, RequestContext context, ContentPage page ) |
1080 |
|
throws FailedToRenderFragmentException |
1081 |
|
{ |
1082 |
0 |
boolean atLeastOneHasHeaderPhase = false; |
1083 |
0 |
boolean hasHeaderPhase = false; |
1084 |
0 |
if ( fragment.getContentFragments() != null && fragment.getContentFragments().size() > 0 ) |
1085 |
|
{ |
1086 |
0 |
Iterator children = fragment.getContentFragments().iterator(); |
1087 |
0 |
while (children.hasNext()) |
1088 |
|
{ |
1089 |
0 |
ContentFragment child = (ContentFragment) children.next(); |
1090 |
0 |
if ( ! "hidden".equals( fragment.getState() ) ) |
1091 |
|
{ |
1092 |
0 |
hasHeaderPhase = aggregateAndRender( child, context, page ); |
1093 |
0 |
if ( hasHeaderPhase ) |
1094 |
|
{ |
1095 |
0 |
atLeastOneHasHeaderPhase = true; |
1096 |
|
} |
1097 |
|
} |
1098 |
0 |
} |
1099 |
|
} |
1100 |
0 |
hasHeaderPhase = renderHeaderFragment( context, fragment ); |
1101 |
0 |
if ( hasHeaderPhase ) |
1102 |
|
{ |
1103 |
0 |
atLeastOneHasHeaderPhase = true; |
1104 |
|
} |
1105 |
0 |
return atLeastOneHasHeaderPhase; |
1106 |
|
} |
1107 |
|
|
1108 |
|
protected boolean renderHeaderFragment( RequestContext context, ContentFragment fragment ) |
1109 |
|
{ |
1110 |
|
try |
1111 |
|
{ |
1112 |
0 |
if ( !fragment.getType().equals( ContentFragment.LAYOUT ) ) |
1113 |
|
{ |
1114 |
0 |
PortletWindow portletWindow = getPortletWindowAccessor().getPortletWindow( fragment ); |
1115 |
0 |
PortletDefinition pd = portletWindow.getPortletEntity().getPortletDefinition(); |
1116 |
0 |
if ( pd != null && getPortletFactory().isPortletApplicationRegistered((PortletApplication)pd.getPortletApplicationDefinition() ) ) |
1117 |
|
{ |
1118 |
0 |
String portletApplicationContextPath = pd.getPortletApplicationDefinition().getWebApplicationDefinition().getContextRoot(); |
1119 |
0 |
Portlet portlet = getPortletFactory().getPortletInstance( context.getConfig().getServletContext().getContext( portletApplicationContextPath ), pd ).getRealPortlet(); |
1120 |
0 |
if ( portlet != null && portlet instanceof SupportsHeaderPhase ) |
1121 |
|
{ |
1122 |
0 |
log.debug( "renderHeaderFragment: " + pd.getName() + " supports header phase" ); |
1123 |
|
|
1124 |
0 |
HeaderResource hr = getHeaderResourceFactory().getHeaderResource( context, this.baseUrlAccess, isDesktop(), getHeaderConfiguration() ); |
1125 |
0 |
PortletHeaderRequest headerRequest = new PortletHeaderRequestImpl( context, portletWindow, portletApplicationContextPath ); |
1126 |
0 |
PortletHeaderResponse headerResponse = new PortletHeaderResponseImpl( context, hr, isDesktop(), getHeaderConfiguration(), getHeaderResourceRegistry() ); |
1127 |
0 |
((SupportsHeaderPhase)portlet).doHeader( headerRequest, headerResponse ); |
1128 |
0 |
return true; |
1129 |
|
} |
1130 |
|
} |
1131 |
|
} |
1132 |
0 |
return false; |
1133 |
|
} |
1134 |
0 |
catch ( Exception e ) |
1135 |
|
{ |
1136 |
0 |
log.error( "renderHeaderFragment failed", e ); |
1137 |
|
} |
1138 |
0 |
return false; |
1139 |
|
} |
1140 |
|
|
1141 |
|
protected PortletFactory getPortletFactory() |
1142 |
|
{ |
1143 |
0 |
return this.factory; |
1144 |
|
} |
1145 |
|
protected PortletWindowAccessor getPortletWindowAccessor() |
1146 |
|
{ |
1147 |
0 |
return this.windowAccessor; |
1148 |
|
} |
1149 |
|
protected HeaderResourceFactory getHeaderResourceFactory() |
1150 |
|
{ |
1151 |
0 |
return this.headerResourceFactory; |
1152 |
|
} |
1153 |
|
protected boolean isDesktop() |
1154 |
|
{ |
1155 |
0 |
return this.isDesktop; |
1156 |
|
} |
1157 |
|
protected Map getHeaderConfiguration() |
1158 |
|
{ |
1159 |
0 |
return this.headerConfiguration; |
1160 |
|
} |
1161 |
|
protected Map getHeaderResourceRegistry() |
1162 |
|
{ |
1163 |
0 |
return this.headerResourceRegistry; |
1164 |
|
} |
1165 |
|
protected Map getHeaderDynamicConfigurationDefault() |
1166 |
|
{ |
1167 |
0 |
return this.headerDynamicConfigurationDefault; |
1168 |
|
} |
1169 |
|
protected Map getHeaderNamedResourcesDefault() |
1170 |
|
{ |
1171 |
0 |
return this.headerNamedResourcesDefault; |
1172 |
|
} |
1173 |
|
protected Map getHeaderNamedResourcesAddedFragmentsDefault() |
1174 |
|
{ |
1175 |
0 |
return this.headerNamedResourcesAddedFragmentsDefault; |
1176 |
|
} |
1177 |
|
protected BasePortalURL getBaseUrlAccess() |
1178 |
|
{ |
1179 |
0 |
return this.baseUrlAccess; |
1180 |
|
} |
1181 |
|
} |