1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.shiro.web.filter.mgt;
20
21 import org.apache.shiro.util.StringUtils;
22 import org.apache.shiro.web.servlet.ProxiedFilterChain;
23
24 import javax.servlet.Filter;
25 import javax.servlet.FilterChain;
26 import java.util.*;
27
28
29
30
31
32
33
34
35 public class SimpleNamedFilterList implements NamedFilterList {
36
37 private String name;
38 private List<Filter> backingList;
39
40
41
42
43
44
45
46
47 public SimpleNamedFilterList(String name) {
48 this(name, new ArrayList<Filter>());
49 }
50
51
52
53
54
55
56
57
58
59 public SimpleNamedFilterList(String name, List<Filter> backingList) {
60 if (backingList == null) {
61 throw new NullPointerException("backingList constructor argument cannot be null.");
62 }
63 this.backingList = backingList;
64 setName(name);
65 }
66
67 protected void setName(String name) {
68 if (!StringUtils.hasText(name)) {
69 throw new IllegalArgumentException("Cannot specify a null or empty name.");
70 }
71 this.name = name;
72 }
73
74 public String getName() {
75 return name;
76 }
77
78 public FilterChain proxy(FilterChain orig) {
79 return new ProxiedFilterChain(orig, this);
80 }
81
82 public boolean add(Filter filter) {
83 return this.backingList.add(filter);
84 }
85
86 public void add(int index, Filter filter) {
87 this.backingList.add(index, filter);
88 }
89
90 public boolean addAll(Collection<? extends Filter> c) {
91 return this.backingList.addAll(c);
92 }
93
94 public boolean addAll(int index, Collection<? extends Filter> c) {
95 return this.backingList.addAll(index, c);
96 }
97
98 public void clear() {
99 this.backingList.clear();
100 }
101
102 public boolean contains(Object o) {
103 return this.backingList.contains(o);
104 }
105
106 public boolean containsAll(Collection<?> c) {
107 return this.backingList.containsAll(c);
108 }
109
110 public Filter get(int index) {
111 return this.backingList.get(index);
112 }
113
114 public int indexOf(Object o) {
115 return this.backingList.indexOf(o);
116 }
117
118 public boolean isEmpty() {
119 return this.backingList.isEmpty();
120 }
121
122 public Iterator<Filter> iterator() {
123 return this.backingList.iterator();
124 }
125
126 public int lastIndexOf(Object o) {
127 return this.backingList.lastIndexOf(o);
128 }
129
130 public ListIterator<Filter> listIterator() {
131 return this.backingList.listIterator();
132 }
133
134 public ListIterator<Filter> listIterator(int index) {
135 return this.backingList.listIterator(index);
136 }
137
138 public Filter remove(int index) {
139 return this.backingList.remove(index);
140 }
141
142 public boolean remove(Object o) {
143 return this.backingList.remove(o);
144 }
145
146 public boolean removeAll(Collection<?> c) {
147 return this.backingList.removeAll(c);
148 }
149
150 public boolean retainAll(Collection<?> c) {
151 return this.backingList.retainAll(c);
152 }
153
154 public Filter set(int index, Filter filter) {
155 return this.backingList.set(index, filter);
156 }
157
158 public int size() {
159 return this.backingList.size();
160 }
161
162 public List<Filter> subList(int fromIndex, int toIndex) {
163 return this.backingList.subList(fromIndex, toIndex);
164 }
165
166 public Object[] toArray() {
167 return this.backingList.toArray();
168 }
169
170 public <T> T[] toArray(T[] a) {
171
172 return this.backingList.toArray(a);
173 }
174 }