KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > context > PortletRequestHandledEvent


1 /*
2  * Copyright 2002-2005 the original author or authors.
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 package org.springframework.web.portlet.context;
18
19 import org.springframework.web.context.support.RequestHandledEvent;
20
21 /**
22  * Portlet-specific subclass of RequestHandledEvent,
23  * adding portlet-specific context information.
24  *
25  * @author Juergen Hoeller
26  * @author John A. Lewis
27  * @since 2.0
28  * @see org.springframework.web.portlet.FrameworkPortlet
29  * @see org.springframework.context.ApplicationContext#publishEvent
30  */

31 public class PortletRequestHandledEvent extends RequestHandledEvent {
32
33     /** Name of the portlet that handled the request */
34     private final String JavaDoc portletName;
35
36     /** PortletMode of the request */
37     private final String JavaDoc portletMode;
38
39     /** Type of Portlet Request */
40     private final String JavaDoc requestType;
41
42
43     /**
44      * Create a new PortletRequestHandledEvent.
45      * @param source the component that published the event
46      * @param portletName the name of the portlet that handled the request
47      * @param portletMode the PortletMode of the request (usually 'view', 'edit', or 'help')
48      * @param requestType the type of Portlet request ('action' or 'render')
49      * @param sessionId the id of the HTTP session, if any
50      * @param userName the name of the user that was associated with the
51      * request, if any (usually the UserPrincipal)
52      * @param processingTimeMillis the processing time of the request in milliseconds
53      */

54     public PortletRequestHandledEvent(Object JavaDoc source, String JavaDoc portletName,
55             String JavaDoc portletMode, String JavaDoc requestType, String JavaDoc sessionId,
56             String JavaDoc userName, long processingTimeMillis) {
57
58         super(source, sessionId, userName, processingTimeMillis);
59         this.portletName = portletName;
60         this.portletMode = portletMode;
61         this.requestType = requestType;
62     }
63
64     /**
65      * Create a new PortletRequestHandledEvent.
66      * @param source the component that published the event
67      * @param portletName the name of the portlet that handled the request
68      * @param portletMode the PortletMode of the request (usually 'view', 'edit', or 'help')
69      * @param requestType the type of Portlet request ('action' or 'render')
70      * @param sessionId the id of the HTTP session, if any
71      * @param userName the name of the user that was associated with the
72      * request, if any (usually the UserPrincipal)
73      * @param processingTimeMillis the processing time of the request in milliseconds
74      * @param failureCause the cause of failure, if any
75      */

76     public PortletRequestHandledEvent(Object JavaDoc source, String JavaDoc portletName,
77             String JavaDoc portletMode, String JavaDoc requestType, String JavaDoc sessionId,
78             String JavaDoc userName, long processingTimeMillis, Throwable JavaDoc failureCause) {
79
80         super(source, sessionId, userName, processingTimeMillis, failureCause);
81         this.portletName = portletName;
82         this.portletMode = portletMode;
83         this.requestType = requestType;
84     }
85
86
87     /**
88      * Return the name of the portlet that handled the request.
89      */

90     public String JavaDoc getPortletName() {
91         return portletName;
92     }
93
94     /**
95      * Return the mode of the portlet request (usually 'view', 'edit', or 'help').
96      */

97     public String JavaDoc getPortletMode() {
98         return portletMode;
99     }
100
101     /**
102      * Return the the type of Portlet Request ('action' or 'render').
103      */

104     public String JavaDoc getRequestType() {
105         return requestType;
106     }
107
108
109     public String JavaDoc getShortDescription() {
110         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
111         sb.append("portlet=[").append(this.portletName).append("]; ");
112         sb.append(super.getShortDescription());
113         return sb.toString();
114     }
115
116     public String JavaDoc getDescription() {
117         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
118         sb.append("portlet=[").append(this.portletName).append("]; ");
119         sb.append("mode=[").append(this.portletMode).append("]; ");
120         sb.append("type=[").append(this.requestType).append("]; ");
121         sb.append(super.getDescription());
122         return sb.toString();
123     }
124
125     public String JavaDoc toString() {
126         return ("PortletRequestHandledEvent: " + getDescription());
127     }
128
129 }
130
Popular Tags