1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.pluto.core;
21
22 import javax.portlet.PortletConfig;
23 import javax.portlet.PortletContext;
24 import javax.portlet.PortletRequest;
25 import javax.portlet.PortletResponse;
26
27 import org.apache.pluto.portlet.PortletRequestWrapper;
28 import org.apache.pluto.portlet.PortletResponseWrapper;
29
30 public class CoreUtils
31 {
32
33 public static InternalPortletRequest getInternalRequest(PortletRequest request)
34 {
35 while (!(request instanceof InternalPortletRequest))
36 {
37 request = ((PortletRequestWrapper)request).getPortletRequest();
38 if (request == null)
39 {
40 throw new IllegalStateException("The internal portlet request cannot be found.");
41 }
42 }
43 return(InternalPortletRequest)request;
44 }
45
46
47 public static InternalPortletResponse getInternalResponse(PortletResponse response)
48 {
49 while (!(response instanceof InternalPortletResponse))
50 {
51 response = ((PortletResponseWrapper)response).getPortletResponse();
52 if (response == null)
53 {
54 throw new IllegalStateException("The internal portlet response cannot be found.");
55 }
56 }
57 return(InternalPortletResponse)response;
58 }
59
60
61 public static InternalPortletConfig getInternalConfig(PortletConfig config)
62 {
63 return(InternalPortletConfig)config;
64 }
65
66
67 public static InternalPortletContext getInternalContext(PortletContext context)
68 {
69 return(InternalPortletContext)context;
70 }
71
72 }