1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.blossom.view; |
35 |
|
|
36 |
|
import java.util.Locale; |
37 |
|
|
38 |
|
import org.springframework.web.servlet.view.AbstractUrlBasedView; |
39 |
|
import org.springframework.web.servlet.view.UrlBasedViewResolver; |
40 |
|
|
41 |
|
import info.magnolia.rendering.renderer.Renderer; |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@since |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
48 |
|
public class TemplateViewResolver extends UrlBasedViewResolver { |
49 |
|
|
50 |
|
private Renderer viewRenderer; |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0 |
public TemplateViewResolver() {... |
53 |
0 |
setViewClass(requiredViewClass()); |
54 |
|
} |
55 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
56 |
|
public void setViewRenderer(Renderer viewRenderer) {... |
57 |
|
this.viewRenderer = viewRenderer; |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0 |
@Override... |
61 |
|
protected Class requiredViewClass() { |
62 |
0 |
return TemplateView.class; |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
65 |
0 |
@Override... |
66 |
|
protected AbstractUrlBasedView buildView(String viewName) throws Exception { |
67 |
0 |
TemplateView view = (TemplateView) super.buildView(viewName); |
68 |
0 |
view.setViewRenderer(viewRenderer); |
69 |
0 |
return view; |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
72 |
0 |
@Override... |
73 |
|
protected boolean canHandle(String viewName, Locale locale) { |
74 |
0 |
if (viewName.startsWith(REDIRECT_URL_PREFIX) || viewName.startsWith(FORWARD_URL_PREFIX)) { |
75 |
0 |
return true; |
76 |
|
} |
77 |
0 |
return super.canHandle(viewName, locale); |
78 |
|
} |
79 |
|
} |