1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.core.context.creator; |
17 | |
|
18 | |
import javax.faces.context.FacesContext; |
19 | |
import javax.faces.lifecycle.Lifecycle; |
20 | |
|
21 | |
import org.seasar.teeda.core.context.creator.portlet.PortletEnvironmentUtil; |
22 | |
import org.seasar.teeda.core.context.creator.portlet.PortletFacesContextCreator; |
23 | |
import org.seasar.teeda.core.context.creator.servlet.ServletEnvironmentUtil; |
24 | |
import org.seasar.teeda.core.context.creator.servlet.ServletFacesContextCreator; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 4 | public class DispatchableFacesContextCreator implements FacesContextCreator { |
31 | |
|
32 | 4 | private ServletFacesContextCreator servletFacesContextCreator = new ServletFacesContextCreator(); |
33 | |
|
34 | 4 | private PortletFacesContextCreator portletFacesContextCreator = new PortletFacesContextCreator(); |
35 | |
|
36 | |
|
37 | |
public FacesContext create(Object context, Object request, Object response, |
38 | |
Lifecycle lifecycle) { |
39 | 6 | if (ServletEnvironmentUtil.isServletEnvironment(context, request, |
40 | |
response)) { |
41 | 2 | return getServletFacesContextCreator().create(context, request, |
42 | |
response, lifecycle); |
43 | 4 | } else if (PortletEnvironmentUtil.isPortletEnvironment(context, |
44 | |
request, response)) { |
45 | 1 | return getPortletFacesContextCreator().create(context, request, |
46 | |
response, lifecycle); |
47 | |
} |
48 | 3 | return null; |
49 | |
} |
50 | |
|
51 | |
public PortletFacesContextCreator getPortletFacesContextCreator() { |
52 | 1 | return portletFacesContextCreator; |
53 | |
} |
54 | |
|
55 | |
public void setPortletFacesContextCreator( |
56 | |
PortletFacesContextCreator portletFacesContextCreator) { |
57 | 1 | this.portletFacesContextCreator = portletFacesContextCreator; |
58 | 1 | } |
59 | |
|
60 | |
public ServletFacesContextCreator getServletFacesContextCreator() { |
61 | 2 | return servletFacesContextCreator; |
62 | |
} |
63 | |
|
64 | |
public void setServletFacesContextCreator( |
65 | |
ServletFacesContextCreator servletFacesContextCreator) { |
66 | 1 | this.servletFacesContextCreator = servletFacesContextCreator; |
67 | 1 | } |
68 | |
|
69 | |
} |