EMMA�Coverage�Report�(generated�Fri�Sep�15�10:32:43�EDT�2006)
[all�classes][org.apache.pluto.driver]

COVERAGE�SUMMARY�FOR�SOURCE�FILE�[PortalDriverServlet.java]

nameclass,�%method,�%block,�%line,�%
PortalDriverServlet.java0%���(0/1)0%���(0/8)0%���(0/170)0%���(0/43)

COVERAGE�BREAKDOWN�BY�CLASS�AND�METHOD

nameclass,�%method,�%block,�%line,�%
class�PortalDriverServlet0%���(0/1)0%���(0/8)0%���(0/170)0%���(0/43)
<static�initializer>0%���(0/1)0%���(0/4)0%���(0/1)
PortalDriverServlet�():�void0%���(0/1)0%���(0/6)0%���(0/2)
doGet�(HttpServletRequest,�HttpServletResponse):�void0%���(0/1)0%���(0/116)0%���(0/29)
doPost�(HttpServletRequest,�HttpServletResponse):�void0%���(0/1)0%���(0/5)0%���(0/2)
getDriverConfiguration�():�DriverConfiguration0%���(0/1)0%���(0/6)0%���(0/1)
getPageConfig�(PortalURL):�PageConfig0%���(0/1)0%���(0/21)0%���(0/4)
getServletInfo�():�String0%���(0/1)0%���(0/2)0%���(0/1)
init�():�void0%���(0/1)0%���(0/10)0%���(0/3)

1/*
2�*�Copyright�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�*/
16package�org.apache.pluto.driver;
17
18import�org.apache.commons.logging.Log;
19import�org.apache.commons.logging.LogFactory;
20import�org.apache.pluto.PortletContainer;
21import�org.apache.pluto.PortletContainerException;
22import�org.apache.pluto.driver.config.DriverConfiguration;
23import�org.apache.pluto.driver.core.PortalEnvironment;
24import�org.apache.pluto.driver.core.PortletWindowImpl;
25import�org.apache.pluto.driver.services.portal.PageConfig;
26import�org.apache.pluto.driver.services.portal.PortletWindowConfig;
27import�org.apache.pluto.driver.url.PortalURL;
28
29import�javax.portlet.PortletException;
30import�javax.servlet.RequestDispatcher;
31import�javax.servlet.ServletContext;
32import�javax.servlet.ServletException;
33import�javax.servlet.http.HttpServlet;
34import�javax.servlet.http.HttpServletRequest;
35import�javax.servlet.http.HttpServletResponse;
36import�java.io.IOException;
37
38/**
39�*�The�controller�servlet�used�to�drive�the�Portal�Driver.�All�requests�mapped
40�*�to�this�servlet�will�be�processed�as�Portal�Requests.
41�*�
42�*�@author�<a�href="mailto:ddewolf@apache.org">David�H.�DeWolf</a>
43�*�@author�<a�href="mailto:zheng@apache.org">ZHENG�Zhong</a>
44�*�@version�1.0
45�*�@since�Sep�22,�2004
46�*/
47public�class�PortalDriverServlet�extends�HttpServlet�{
48
49����/**�Internal�Logger.�*/
50����private�static�final�Log�LOG�=�LogFactory.getLog(PortalDriverServlet.class);
51����
52����protected�static�final�String�DEFAULT_PAGE_URI�=
53��������������������"/WEB-INF/themes/pluto-default-theme.jsp";
54����
55����/**�The�portlet�container�to�which�we�will�forward�all�portlet�requests.�*/
56����protected�PortletContainer�container�=�null;
57����
58����
59����//�HttpServlet�Impl�--------------------------------------------------------
60����
61����public�String�getServletInfo()�{
62��������return�"Pluto�Portal�Driver�Servlet";
63����}
64����
65����/**
66�����*�Initialize�the�Portal�Driver.�This�method�retrieves�the�portlet�container
67�����*�instance�from�the�servlet�context�scope.
68�����*�@see�PortletContainer
69�����*/
70����public�void�init()�{
71��������ServletContext�servletContext�=�getServletContext();
72��������container�=�(PortletContainer)�servletContext.getAttribute(
73������������������������AttributeKeys.PORTLET_CONTAINER);
74����}
75����
76
77����/**
78�����*�Handle�all�requests.�All�POST�requests�are�passed�to�this�method.
79�����*�@param�request��the�incoming�HttpServletRequest.
80�����*�@param�response��the�incoming�HttpServletResponse.
81�����*�@throws�ServletException��if�an�internal�error�occurs.
82�����*�@throws�IOException��if�an�error�occurs�writing�to�the�response.
83�����*/
84����public�void�doGet(HttpServletRequest�request,�HttpServletResponse�response)
85����throws�ServletException,�IOException�{
86������������
87��������PortalEnvironment�portalEnvironment�=�new�PortalEnvironment(
88������������������������request,�response);
89��������PortalURL�portalURL�=�portalEnvironment.getRequestedPortalURL();
90��������String�actionWindowId�=�portalURL.getActionWindow();
91��������PortletWindowConfig�actionWindowConfig�=�getDriverConfiguration()
92������������������������.getPortletWindowConfig(actionWindowId);
93
94��������//�Action�window�config�will�only�exist�if�there�is�an�action�request.
95��������if�(actionWindowConfig�!=�null)�{
96������������PortletWindowImpl�portletWindow�=�new�PortletWindowImpl(
97����������������������������actionWindowConfig,�portalURL);
98������������if�(LOG.isDebugEnabled())�{
99����������������LOG.debug("Processing�action�request�for�window:�"
100��������������������������������+�portletWindow.getId().getStringId());
101������������}
102������������try�{
103����������������container.doAction(portletWindow,�request,�response);
104������������}�catch�(PortletContainerException�ex)�{
105����������������throw�new�ServletException(ex);
106������������}�catch�(PortletException�ex)�{
107����������������throw�new�ServletException(ex);
108������������}
109������������if�(LOG.isDebugEnabled())�{
110��������������������LOG.debug("Action�request�processed.\n\n");
111������������}
112��������}
113��������
114��������//�Otherwise�(actionWindowConfig�==�null),�handle�the�render�request.
115��������else�{
116����������������if�(LOG.isDebugEnabled())�{
117������������������������LOG.debug("Processing�render�request.");
118����������������}
119������������PageConfig�pageConfig�=�getPageConfig(portalURL);
120������������request.setAttribute(AttributeKeys.CURRENT_PAGE,�pageConfig);
121������������String�uri�=�(pageConfig.getUri()�!=�null)
122����������������������������?�pageConfig.getUri()�:�DEFAULT_PAGE_URI;
123������������if�(LOG.isDebugEnabled())�{
124��������������������LOG.debug("Dispatching�to:�"�+�uri);
125������������}
126������������RequestDispatcher�dispatcher�=�request.getRequestDispatcher(uri);
127������������dispatcher.forward(request,�response);
128������������if�(LOG.isDebugEnabled())�{
129��������������������LOG.debug("Render�request�processed.\n\n");
130������������}
131��������}
132����}
133
134����/**
135�����*�Pass�all�POST�requests�to�{@link�#doGet(HttpServletRequest,�HttpServletResponse)}.
136�����*�@param�request��the�incoming�servlet�request.
137�����*�@param�response��the�incoming�servlet�response.
138�����*�@throws�ServletException�if�an�exception�occurs.
139�����*�@throws�IOException�if�an�exception�occurs�writing�to�the�response.
140�����*/
141����public�void�doPost(HttpServletRequest�request,�HttpServletResponse�response)
142����throws�ServletException,�IOException�{
143��������doGet(request,�response);
144����}
145����
146����
147����//�Private�Methods�---------------------------------------------------------
148����
149����/**
150�����*�Returns�the�config�of�the�portal�page�to�be�rendered.
151�����*�@param�currentURL��the�current�portal�URL.
152�����*�@return�the�config�of�the�portal�page�to�be�rendered.
153�����*/
154����private�PageConfig�getPageConfig(PortalURL�currentURL)�{
155��������String�requestedPageId�=�currentURL.getRenderPath();
156��������if�(LOG.isDebugEnabled())�{
157������������LOG.debug("Rendering�Portal:�Requested�Page:�"�+�requestedPageId);
158��������}
159��������return�getDriverConfiguration().getPageConfig(requestedPageId);
160����}
161����
162����/**
163�����*�Returns�the�portal�driver�configuration�object.
164�����*�@return�the�portal�driver�configuration�object.
165�����*/
166����private�DriverConfiguration�getDriverConfiguration()�{
167��������return�(DriverConfiguration)�getServletContext().getAttribute(
168������������������������AttributeKeys.DRIVER_CONFIG);
169����}
170
171����
172����
173}
174

[all�classes][org.apache.pluto.driver]
EMMA�2.0.5312�(C)�Vladimir�Roubtsov