KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > core > impl > RenderRequestImpl


1 /*
2  * Copyright 2003,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17
18  */

19
20 package org.apache.pluto.core.impl;
21
22 import java.io.BufferedReader JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.util.Enumeration JavaDoc;
25
26 import javax.portlet.PortletPreferences;
27 import javax.portlet.RenderRequest;
28
29 import org.apache.pluto.PortletContainerServices;
30 import org.apache.pluto.factory.PortletObjectAccess;
31 import org.apache.pluto.om.window.PortletWindow;
32 import org.apache.pluto.services.log.LogService;
33 import org.apache.pluto.services.log.Logger;
34
35 /**
36
37  *
38  * To change this generated comment edit the template variable "typecomment":
39  * Window>Preferences>Java>Templates.
40  * To enable and disable the creation of type comments go to
41  * Window>Preferences>Java>Code Generation.
42  */

43 public class RenderRequestImpl extends PortletRequestImpl implements RenderRequest {
44     /**
45      * Holds the portlet preferences
46      */

47     private PortletPreferences portletPreferences = null;
48     private Logger log = null;
49
50     public RenderRequestImpl(PortletWindow portletWindow,
51                              javax.servlet.http.HttpServletRequest JavaDoc servletRequest)
52     {
53         super(portletWindow, servletRequest);
54         this.log = ((LogService)PortletContainerServices
55                       .get(LogService.class)).getLogger(getClass());
56     }
57
58     // additional methods -------------------------------------------------------------------------
59
/**
60      * @see javax.servlet.ServletRequest#getReader()
61      */

62     public BufferedReader JavaDoc getReader() throws IOException JavaDoc
63     {
64         return super.getReader();
65     }
66
67     public PortletPreferences getPreferences()
68     {
69         if(log.isDebugEnabled()) {
70             log.debug("Getting Preferences: "+portletPreferences);
71         }
72
73         if (portletPreferences == null) {
74             portletPreferences = PortletObjectAccess.getPortletPreferences(
75                 org.apache.pluto.Constants.METHOD_RENDER,
76                 super.getInternalPortletWindow().getPortletEntity()
77             );
78         }
79         if(log.isDebugEnabled()) {
80             log.debug("Returning Preferences: " + portletPreferences);
81             Enumeration JavaDoc e = portletPreferences.getNames();
82             while (e.hasMoreElements()) {
83                 String JavaDoc name = (String JavaDoc)e.nextElement();
84                 log.debug(" - Preference: name = " + name);
85             }
86         }
87
88         return portletPreferences;
89     }
90     // --------------------------------------------------------------------------------------------
91
}
92
Popular Tags