KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > nav > util > NavUtil


1 package org.exoplatform.portlets.nav.util;
2
3 import javax.faces.context.FacesContext;
4 import javax.portlet.ActionResponse;
5 import javax.portlet.PortletContext;
6 import javax.portlet.PortletPreferences;
7 import javax.portlet.PortletRequest;
8 import javax.portlet.PortletURL;
9 import javax.portlet.RenderResponse;
10
11 /**
12  *
13  * @version $Revision: 1.1.1.1 $ $Date: 2004/08/05 13:11:14 $
14  * @author Fahrid Djebbari
15  *
16  */

17
18 public class NavUtil {
19     
20     public static PortletContext getPortletContext() {
21         return (PortletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
22     }
23     
24     private static PortletRequest getPortletRequest() {
25         return (PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
26     }
27     
28     public static ActionResponse getPortletResponse() {
29         return (ActionResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
30     }
31     
32     private static RenderResponse getRenderResponse() {
33         return (RenderResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
34     }
35
36     public static PortletURL createActionURL() {
37         return getRenderResponse().createActionURL();
38     }
39     
40     public static PortletURL createRenderURL() {
41         return getRenderResponse().createRenderURL();
42     }
43     
44     public static PortletPreferences getPortletPreferences() {
45         return getPortletRequest().getPreferences();
46     }
47 }
Popular Tags