View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.test.utils;
20  
21  import java.io.IOException;
22  
23  import javax.faces.FacesException;
24  import javax.faces.component.UIComponent;
25  import javax.faces.context.FacesContext;
26  import javax.faces.render.RenderKit;
27  import javax.faces.render.Renderer;
28  
29  import org.apache.commons.logging.Log;
30  import org.apache.commons.logging.LogFactory;
31  
32  public final class TestUtils
33  {
34      /** Default Logger */
35      private static final Log log = LogFactory.getLog(TestUtils.class);
36  
37      /** utility class, do not instantiate */
38      private TestUtils()
39      {
40          // utility class, disable instantiation
41      }
42  
43      /**
44       * Add all of Tomahawk's renderers.  Currently this is not tied to 
45       * faces-config.xml, so all change to the file MUST also be made here.
46       * 
47       * @param facesContext
48       * @todo Do not add renderer if renderer is already added.
49       */
50      public static void addDefaultRenderers(FacesContext facesContext)
51      {
52          // Standard HTML Renderers
53          addRenderer(facesContext, "javax.faces.Command", "javax.faces.Button",
54                  "org.apache.myfaces.renderkit.html.HtmlButtonRenderer");
55  
56          addRenderer(facesContext, "javax.faces.SelectBoolean",
57                  "javax.faces.Checkbox",
58                  "org.apache.myfaces.renderkit.html.HtmlCheckboxRenderer");
59  
60          addRenderer(facesContext, "javax.faces.SelectMany",
61                  "javax.faces.Checkbox",
62                  "org.apache.myfaces.renderkit.html.HtmlCheckboxRenderer");
63  
64          addRenderer(facesContext, "javax.faces.Form", "javax.faces.Form",
65                  "org.apache.myfaces.renderkit.html.HtmlFormRenderer");
66  
67          addRenderer(facesContext, "javax.faces.Panel", "javax.faces.Grid",
68                  "org.apache.myfaces.renderkit.html.HtmlGridRenderer");
69  
70          addRenderer(facesContext, "javax.faces.Panel", "javax.faces.Group",
71                  "org.apache.myfaces.renderkit.html.HtmlGroupRenderer");
72  
73          addRenderer(facesContext, "javax.faces.Input", "javax.faces.Hidden",
74                  "org.apache.myfaces.renderkit.html.HtmlHiddenRenderer");
75  
76          addRenderer(facesContext, "javax.faces.Input", "org.apache.myfaces.Hidden",
77                  "org.apache.myfaces.renderkit.html.ext.HtmlHiddenRenderer");
78          
79          addRenderer(facesContext, "javax.faces.Graphic", "javax.faces.Image",
80                  "org.apache.myfaces.renderkit.html.HtmlImageRenderer");
81  
82          addRenderer(facesContext, "javax.faces.Output", "javax.faces.Label",
83                  "org.apache.myfaces.renderkit.html.HtmlLabelRenderer");
84  
85          addRenderer(facesContext, "javax.faces.Output", "javax.faces.Link",
86                  "org.apache.myfaces.renderkit.html.HtmlLinkRenderer");
87  
88          addRenderer(facesContext, "javax.faces.Command", "javax.faces.Link",
89                  "org.apache.myfaces.renderkit.html.HtmlLinkRenderer");
90  
91          addRenderer(facesContext, "javax.faces.SelectOne",
92                  "javax.faces.Listbox",
93                  "org.apache.myfaces.renderkit.html.HtmlListboxRenderer");
94  
95          addRenderer(facesContext, "javax.faces.SelectMany",
96                  "javax.faces.Listbox",
97                  "org.apache.myfaces.renderkit.html.HtmlListboxRenderer");
98  
99          addRenderer(facesContext, "javax.faces.SelectOne", "javax.faces.Menu",
100                 "org.apache.myfaces.renderkit.html.HtmlMenuRenderer");
101 
102         addRenderer(facesContext, "javax.faces.SelectMany", "javax.faces.Menu",
103                 "org.apache.myfaces.renderkit.html.HtmlMenuRenderer");
104 
105         addRenderer(facesContext, "javax.faces.Message", "javax.faces.Message",
106                 "org.apache.myfaces.renderkit.html.HtmlMessageRenderer");
107 
108         addRenderer(facesContext, "javax.faces.Output", "javax.faces.Format",
109                 "org.apache.myfaces.renderkit.html.HtmlFormatRenderer");
110 
111         addRenderer(facesContext, "javax.faces.Messages",
112                 "javax.faces.Messages",
113                 "org.apache.myfaces.renderkit.html.HtmlMessagesRenderer");
114 
115         addRenderer(facesContext, "javax.faces.SelectOne", "javax.faces.Radio",
116                 "org.apache.myfaces.renderkit.html.HtmlRadioRenderer");
117 
118         addRenderer(facesContext, "javax.faces.Input", "javax.faces.Secret",
119                 "org.apache.myfaces.renderkit.html.HtmlSecretRenderer");
120 
121         addRenderer(facesContext, "javax.faces.Data", "javax.faces.Table",
122                 "org.apache.myfaces.renderkit.html.HtmlTableRenderer");
123 
124         addRenderer(facesContext, "javax.faces.Input", "javax.faces.Textarea",
125                 "org.apache.myfaces.renderkit.html.HtmlTextareaRenderer");
126 
127         addRenderer(facesContext, "javax.faces.Input", "javax.faces.Text",
128                 "org.apache.myfaces.renderkit.html.HtmlTextRenderer");
129 
130         addRenderer(facesContext, "javax.faces.Output", "javax.faces.Text",
131                 "org.apache.myfaces.renderkit.html.HtmlTextRenderer");
132 
133         // extended standard renderers
134 
135         addRenderer(facesContext, "javax.faces.Command",
136                 "org.apache.myfaces.Button",
137                 "org.apache.myfaces.renderkit.html.ext.HtmlButtonRenderer");
138 
139         addRenderer(facesContext, "javax.faces.Command",
140                 "org.apache.myfaces.Link",
141                 "org.apache.myfaces.renderkit.html.ext.HtmlLinkRenderer");
142 
143         addRenderer(facesContext, "javax.faces.Data",
144                 "org.apache.myfaces.Table",
145                 "org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer");
146 
147         addRenderer(facesContext, "javax.faces.Panel",
148                 "org.apache.myfaces.Grid",
149                 "org.apache.myfaces.renderkit.html.ext.HtmlGridRenderer");
150 
151         addRenderer(facesContext, "javax.faces.Panel",
152                 "org.apache.myfaces.Group",
153                 "org.apache.myfaces.renderkit.html.ext.HtmlGroupRenderer");
154 
155         addRenderer(facesContext, "javax.faces.Input",
156                 "org.apache.myfaces.Secret",
157                 "org.apache.myfaces.renderkit.html.ext.HtmlSecretRenderer");
158 
159         addRenderer(facesContext, "javax.faces.Graphic",
160                 "org.apache.myfaces.Image",
161                 "org.apache.myfaces.renderkit.html.ext.HtmlImageRenderer");
162 
163         addRenderer(facesContext, "javax.faces.Input",
164                 "org.apache.myfaces.Text",
165                 "org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer");
166 
167         addRenderer(facesContext, "javax.faces.Input",
168                 "org.apache.myfaces.TextHelp",
169                 "org.apache.myfaces.custom.inputTextHelp.HtmlTextHelpRenderer");
170 
171         addRenderer(facesContext, "javax.faces.Input",
172                 "org.apache.myfaces.Textarea",
173                 "org.apache.myfaces.renderkit.html.ext.HtmlTextareaRenderer");
174 
175         addRenderer(facesContext, "javax.faces.Message",
176                 "org.apache.myfaces.Message",
177                 "org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer");
178 
179         addRenderer(facesContext, "javax.faces.Messages",
180                 "org.apache.myfaces.Messages",
181                 "org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer");
182 
183         addRenderer(facesContext, "javax.faces.Output",
184                 "org.apache.myfaces.Text",
185                 "org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer");
186 
187         addRenderer(facesContext, "javax.faces.SelectBoolean",
188                 "org.apache.myfaces.Checkbox",
189                 "org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer");
190 
191         addRenderer(facesContext, "javax.faces.SelectMany",
192                 "org.apache.myfaces.Checkbox",
193                 "org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer");
194 
195         addRenderer(facesContext, "javax.faces.SelectOne",
196                 "org.apache.myfaces.Menu",
197                 "org.apache.myfaces.renderkit.html.ext.HtmlMenuRenderer");
198 
199         addRenderer(facesContext, "javax.faces.SelectMany",
200                 "org.apache.myfaces.Menu",
201                 "org.apache.myfaces.renderkit.html.ext.HtmlMenuRenderer");
202 
203         addRenderer(facesContext, "javax.faces.SelectOne",
204                 "org.apache.myfaces.Listbox",
205                 "org.apache.myfaces.renderkit.html.ext.HtmlListboxRenderer");
206 
207         addRenderer(facesContext, "javax.faces.SelectMany",
208                 "org.apache.myfaces.Listbox",
209                 "org.apache.myfaces.renderkit.html.ext.HtmlListboxRenderer");
210 
211         addRenderer(facesContext, "javax.faces.SelectOne",
212                 "org.apache.myfaces.Radio",
213                 "org.apache.myfaces.renderkit.html.ext.HtmlRadioRenderer");
214 
215         //  custom component renderers
216 
217         addRenderer(facesContext, "javax.faces.Data",
218                 "org.apache.myfaces.Buffer",
219                 "org.apache.myfaces.custom.buffer.BufferRenderer");
220 
221         addRenderer(facesContext, "javax.faces.Data",
222                 "org.apache.myfaces.Document",
223                 "org.apache.myfaces.custom.document.DocumentRenderer");
224 
225         addRenderer(facesContext, "javax.faces.Data",
226                 "org.apache.myfaces.DocumentHead",
227                 "org.apache.myfaces.custom.document.DocumentHeadRenderer");
228 
229         addRenderer(facesContext, "javax.faces.Data",
230                 "org.apache.myfaces.DocumentBody",
231                 "org.apache.myfaces.custom.document.DocumentBodyRenderer");
232 
233         addRenderer(facesContext, "org.apache.myfaces.Checkbox",
234                 "org.apache.myfaces.Checkbox",
235                 "org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer");
236 
237         addRenderer(facesContext, "javax.faces.Panel",
238                 "org.apache.myfaces.DataScroller",
239                 "org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer");
240 
241         addRenderer(facesContext, "javax.faces.Input",
242                 "org.apache.myfaces.Calendar",
243                 "org.apache.myfaces.custom.calendar.HtmlCalendarRenderer");
244 
245         addRenderer(facesContext, "javax.faces.Input",
246                 "org.apache.myfaces.Date",
247                 "org.apache.myfaces.custom.date.HtmlDateRenderer");
248 
249         addRenderer(facesContext, "javax.faces.Input",
250                 "org.apache.myfaces.FileUpload",
251                 "org.apache.myfaces.custom.fileupload.HtmlFileUploadRenderer");
252 
253         addRenderer(facesContext, "javax.faces.Input",
254                 "org.apache.myfaces.InputHtml",
255                 "org.apache.myfaces.custom.inputHtml.InputHtmlRenderer");
256 
257         addRenderer(facesContext, "javax.faces.Panel",
258                 "org.apache.myfaces.Popup",
259                 "org.apache.myfaces.custom.popup.HtmlPopupRenderer");
260 
261         addRenderer(facesContext, "javax.faces.Panel",
262                 "org.apache.myfaces.Layout",
263                 "org.apache.myfaces.custom.layout.HtmlLayoutRenderer");
264 
265         addRenderer(facesContext, "javax.faces.Panel",
266                 "org.apache.myfaces.Navigation",
267                 "org.apache.myfaces.custom.navigation.HtmlNavigationRenderer");
268 
269         addRenderer(facesContext, "javax.faces.Panel",
270                 "org.apache.myfaces.NavigationMenu",
271                 "org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlNavigationMenuRenderer");
272 
273         addRenderer(facesContext, "javax.faces.Command",
274                 "org.apache.myfaces.Navigation",
275                 "org.apache.myfaces.custom.navigation.HtmlNavigationRenderer");
276 
277         addRenderer(facesContext, "javax.faces.Command",
278                 "org.apache.myfaces.NavigationMenu",
279                 "org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlNavigationMenuRenderer");
280 
281         addRenderer(facesContext, "javax.faces.Command",
282                 "org.apache.myfaces.JSCookMenu",
283                 "org.apache.myfaces.custom.navmenu.jscookmenu.HtmlJSCookMenuRenderer");
284 
285         addRenderer(facesContext, "javax.faces.Command",
286                 "org.apache.myfaces.SortHeader",
287                 "org.apache.myfaces.custom.sortheader.HtmlSortHeaderRenderer");
288 
289         addRenderer(facesContext, "javax.faces.Panel",
290                 "org.apache.myfaces.TabbedPane",
291                 "org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer");
292 
293         addRenderer(facesContext, "javax.faces.Panel",
294                 "org.apache.myfaces.CollapsiblePanel",
295                 "org.apache.myfaces.custom.collapsiblepanel.HtmlCollapsiblePanelRenderer");
296 
297         addRenderer(facesContext, "javax.faces.Data",
298                 "org.apache.myfaces.List",
299                 "org.apache.myfaces.custom.datalist.HtmlListRenderer");
300 
301         addRenderer(facesContext, "javax.faces.Data",
302                 "org.apache.myfaces.HtmlNewspaperTable",
303                 "org.apache.myfaces.custom.newspaper.HtmlNewspaperTableRenderer");
304 
305         addRenderer(facesContext, "javax.faces.Output",
306                 "org.apache.myfaces.JsValueSet",
307                 "org.apache.myfaces.custom.jsvalueset.HtmlJsValueSetRenderer");
308 
309         addRenderer(facesContext, "javax.faces.Output",
310                 "org.apache.myfaces.JsValueChangeListener",
311                 "org.apache.myfaces.custom.jslistener.JsValueChangeListenerRenderer");
312 
313         addRenderer(facesContext, "org.apache.myfaces.Radio",
314                 "org.apache.myfaces.Radio",
315                 "org.apache.myfaces.renderkit.html.ext.HtmlRadioRenderer");
316 
317         addRenderer(facesContext, "javax.faces.SelectOne",
318                 "org.apache.myfaces.SelectOneCountryRenderer",
319                 "org.apache.myfaces.custom.selectOneCountry.SelectOneCountryRenderer");
320 
321         addRenderer(facesContext, "javax.faces.SelectOne",
322                 "org.apache.myfaces.SelectOneLanguageRenderer",
323                 "org.apache.myfaces.custom.selectOneLanguage.SelectOneLanguageRenderer");
324 
325         addRenderer(facesContext, "javax.faces.Output",
326                 "org.apache.myfaces.Stylesheet",
327                 "org.apache.myfaces.custom.stylesheet.StylesheetRenderer");
328 
329         addRenderer(facesContext, "javax.faces.Output",
330                 "org.apache.myfaces.HtmlTagRenderer",
331                 "org.apache.myfaces.custom.htmlTag.HtmlTagRenderer");
332 
333         addRenderer(facesContext, "javax.faces.Output",
334                 "org.apache.myfaces.DojoInitializerRenderer",
335                 "org.apache.myfaces.custom.dojo.DojoInitializerRenderer");
336 
337         addRenderer(facesContext, "org.apache.myfaces.HtmlTree2",
338                 "org.apache.myfaces.HtmlTree2",
339                 "org.apache.myfaces.custom.tree2.HtmlTreeRenderer");
340 
341         addRenderer(facesContext, "org.apache.myfaces.HtmlTree",
342                 "org.apache.myfaces.HtmlTree",
343                 "org.apache.myfaces.custom.tree.renderkit.html.HtmlTreeRenderer");
344 
345         addRenderer(
346                 facesContext,
347                 "org.apache.myfaces.HtmlTree",
348                 "org.apache.myfaces.HtmlTreeImageCommandLink",
349                 "org.apache.myfaces.custom.tree.renderkit.html.HtmlTreeImageCommandLinkRenderer");
350 
351         addRenderer(facesContext, "org.apache.myfaces.HtmlTreeCheckbox",
352                 "org.apache.myfaces.HtmlTreeCheckbox",
353                 "org.apache.myfaces.custom.tree.renderkit.html.HtmlTreeCheckboxRenderer");
354 
355         addRenderer(facesContext, "javax.faces.Command",
356                 "org.apache.myfaces.HtmlTreeNode",
357                 "org.apache.myfaces.custom.tree.renderkit.html.HtmlTreeNodeRenderer");
358 
359         addRenderer(facesContext, "javax.faces.Panel",
360                 "org.apache.myfaces.PanelStack",
361                 "org.apache.myfaces.custom.panelstack.HtmlPanelStackRenderer");
362 
363         addRenderer(facesContext, "javax.faces.Graphic",
364                 "org.apache.myfaces.SwapImage",
365                 "org.apache.myfaces.custom.swapimage.HtmlSwapImageRenderer");
366 
367         addRenderer(facesContext, "javax.faces.Panel",
368                 "org.apache.myfaces.Schedule",
369                 "org.apache.myfaces.custom.schedule.ScheduleDelegatingRenderer");
370 
371         addRenderer(facesContext, "javax.faces.Data",
372                 "org.apache.myfaces.Table",
373                 "org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer");
374         
375         addRenderer(facesContext, "org.apache.myfaces.CAPTCHA",
376                 "org.apache.myfaces.CAPTCHA",
377                 "org.apache.myfaces.custom.captcha.CAPTCHARenderer");
378         
379         addRenderer(facesContext, "javax.faces.Output",
380                 "org.apache.myfaces.DivRenderer",
381                 "org.apache.myfaces.custom.div.DivRenderer");
382         
383         addRenderer(facesContext, "javax.faces.SelectMany",
384                 "org.apache.myfaces.PicklistRenderer",
385                 "org.apache.myfaces.custom.picklist.HtmlPicklistRenderer");
386         
387         addRenderer(facesContext, "org.apache.myfaces.SelectOneRow",
388                 "org.apache.myfaces.SelectOneRow",
389                 "org.apache.myfaces.custom.selectOneRow.SelectOneRowRenderer");
390         
391         addRenderer(facesContext, "org.apache.myfaces.HtmlTree",
392                 "javax.faces.Group",
393                 "org.apache.myfaces.custom.tree.renderkit.html.HtmlTreeRenderer");
394         addRenderer(facesContext, "javax.faces.Output",
395                 "org.apache.myfaces.FieldsetRenderer",
396                 "org.apache.myfaces.custom.fieldset.FieldsetRenderer");
397         addRenderer(facesContext, "javax.faces.Panel",
398                 "org.apache.myfaces.ToggleGroup",
399                 "org.apache.myfaces.custom.toggle.ToggleGroupRenderer");
400         
401         addRenderer(facesContext, "javax.faces.Output",
402                 "org.apache.myfaces.ToggleLink",
403                 "org.apache.myfaces.custom.toggle.ToggleLinkRenderer");
404         
405         addRenderer(facesContext, "javax.faces.Panel",
406                 "org.apache.myfaces.TogglePanel",
407                 "org.apache.myfaces.custom.toggle.TogglePanelRenderer");
408     }
409 
410     /**
411      * Add a renderer to the FacesContext.
412      * 
413      * @param facesContext Faces Context
414      * @param family Componenet Family
415      * @param rendererType Component Type
416      * @param renderClassName Class Name of Renderer
417      */
418     public static void addRenderer(FacesContext facesContext, String family,
419             String rendererType, String renderClassName)
420     {
421         Renderer renderer = (javax.faces.render.Renderer) newInstance(renderClassName);
422         RenderKit kit = facesContext.getRenderKit();
423         kit.addRenderer(family, rendererType, renderer);
424     }
425 
426     /**
427      * Tries a Class.loadClass with the context class loader of the current thread first and
428      * automatically falls back to the ClassUtils class loader (i.e. the loader of the
429      * myfaces.jar lib) if necessary.
430      * 
431      * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
432      *
433      * @param type fully qualified name of a non-primitive non-array class
434      * @return the corresponding Class
435      * @throws NullPointerException if type is null
436      * @throws ClassNotFoundException
437      */
438     private static Class classForName(String type)
439             throws ClassNotFoundException
440     {
441         if (type == null)
442             throw new NullPointerException("type");
443         try
444         {
445             // Try WebApp ClassLoader first
446             return Class.forName(type, false, // do not initialize for faster startup
447                     Thread.currentThread().getContextClassLoader());
448         }
449         catch (ClassNotFoundException ignore)
450         {
451             // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
452             return Class.forName(type, false, // do not initialize for faster startup
453                     TestUtils.class.getClassLoader());
454         }
455     }
456 
457     /**
458      * Same as {@link #classForName(String)}, but throws a RuntimeException
459      * (FacesException) instead of a ClassNotFoundException.
460      *
461      * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
462      *
463      * @return the corresponding Class
464      * @throws NullPointerException if type is null
465      * @throws FacesException if class not found
466      */
467     private static Class simpleClassForName(String type)
468     {
469         try
470         {
471             return classForName(type);
472         }
473         catch (ClassNotFoundException e)
474         {
475             log.error("Class " + type + " not found", e);
476             throw new FacesException(e);
477         }
478     }
479 
480     /**
481      * Create an instance of the class with the type of <code>type</code>.
482      * 
483      * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
484      *
485      * @param type Type of new class.
486      * @return Instance of the class <code>type</code>
487      * @throws FacesException
488      */
489     private static Object newInstance(String type) throws FacesException
490     {
491         if (type == null)
492             return null;
493         return newInstance(simpleClassForName(type));
494     }
495 
496     /**
497      * Create an instance of the class <code>clazz</code>.
498      * 
499      * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
500      *
501      * @param clazz Class to create an instance of.
502      * @return Instance of the class <code>clazz</code>
503      * @throws FacesException
504      */
505     private static Object newInstance(Class clazz) throws FacesException
506     {
507         try
508         {
509             return clazz.newInstance();
510         }
511         catch (NoClassDefFoundError e)
512         {
513             log.error("Class : " + clazz.getName() + " not found.", e);
514             throw new FacesException(e);
515         }
516         catch (InstantiationException e)
517         {
518             log.error(e.getMessage(), e);
519             throw new FacesException(e);
520         }
521         catch (IllegalAccessException e)
522         {
523             log.error(e.getMessage(), e);
524             throw new FacesException(e);
525         }
526     }
527 
528     /**
529      * Renderered a component, including it's children, then complete the reponse.
530      * 
531      * @param context Faces Context
532      * @param component Component to be rendered.
533      * @throws IOException Thrown while rendering.
534      */
535     public static void renderComponent(FacesContext context,
536             UIComponent component) throws IOException
537     {
538         Renderer renderer = context.getRenderKit().getRenderer(
539                 component.getFamily(), component.getRendererType());
540         renderer.encodeBegin(context, component);
541         renderer.encodeChildren(context, component);
542         renderer.encodeEnd(context, component);
543         context.responseComplete();
544         context.renderResponse();
545     }
546 }