1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.core.context; |
17 | |
|
18 | |
import javax.faces.FacesException; |
19 | |
import javax.faces.context.FacesContext; |
20 | |
import javax.faces.context.FacesContextFactory; |
21 | |
import javax.faces.lifecycle.Lifecycle; |
22 | |
|
23 | |
import org.seasar.framework.util.AssertionUtil; |
24 | |
import org.seasar.teeda.core.context.creator.DispatchableFacesContextCreator; |
25 | |
import org.seasar.teeda.core.context.creator.FacesContextCreator; |
26 | |
import org.seasar.teeda.core.exception.FacesContextNotFoundRuntimeException; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class FacesContextFactoryImpl extends FacesContextFactory { |
32 | |
|
33 | |
private FacesContextCreator contextCreator; |
34 | |
|
35 | 2 | public FacesContextFactoryImpl() { |
36 | 2 | contextCreator = new DispatchableFacesContextCreator(); |
37 | 2 | } |
38 | |
|
39 | |
public FacesContext getFacesContext(Object context, Object request, |
40 | |
Object response, Lifecycle lifecycle) throws FacesException { |
41 | 4 | AssertionUtil.assertNotNull("Context", context); |
42 | 4 | AssertionUtil.assertNotNull("Request", request); |
43 | 4 | AssertionUtil.assertNotNull("Response", response); |
44 | 4 | AssertionUtil.assertNotNull("Lifecycle", lifecycle); |
45 | 4 | FacesContext facesContext = contextCreator.create(context, request, |
46 | |
response, lifecycle); |
47 | 4 | if (facesContext == null) { |
48 | 3 | throw new FacesContextNotFoundRuntimeException(); |
49 | |
} |
50 | 1 | return facesContext; |
51 | |
} |
52 | |
|
53 | |
} |