File tree Expand file tree Collapse file tree 4 files changed +54
-2
lines changed
main/java/org/javalite/activeweb Expand file tree Collapse file tree 4 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -198,9 +198,11 @@ protected List<HttpMethod> allowedActions(String actionMethodName) {
198
198
if (annotations .length == 0 ) {
199
199
return Collections .singletonList (HttpMethod .GET );
200
200
} else {
201
- List <HttpMethod > res = new ArrayList <HttpMethod >();
201
+ List <HttpMethod > res = new ArrayList <>();
202
202
for (Annotation annotation : annotations ) {
203
- res .add (HttpMethod .valueOf (annotation .annotationType ().getSimpleName ()));
203
+ try {
204
+ res .add (HttpMethod .valueOf (annotation .annotationType ().getSimpleName ()));
205
+ } catch (IllegalArgumentException ignore ) {} // we do not know this annotation
204
206
}
205
207
return res ;
206
208
}
Original file line number Diff line number Diff line change
1
+ package app .controllers ;
2
+
3
+ import java .lang .annotation .ElementType ;
4
+ import java .lang .annotation .Retention ;
5
+ import java .lang .annotation .RetentionPolicy ;
6
+ import java .lang .annotation .Target ;
7
+
8
+ /**
9
+ * @author Igor Polevoy on 12/10/15.
10
+ */
11
+ @ Retention (RetentionPolicy .RUNTIME )
12
+ @ Target (ElementType .METHOD )
13
+ public @interface BlahAnnotation {}
Original file line number Diff line number Diff line change
1
+ package app .controllers ;
2
+
3
+ import org .javalite .activeweb .AppController ;
4
+ import org .javalite .activeweb .annotations .GET ;
5
+
6
+ /**
7
+ * @author Igor Polevoy on 12/10/15.
8
+ */
9
+ public class Issue193Controller extends AppController {
10
+
11
+ @ GET @ BlahAnnotation
12
+ public void index (){
13
+ respond ("ok" );
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ package org .javalite .activeweb ;
2
+
3
+ import org .junit .Test ;
4
+
5
+ import javax .servlet .ServletException ;
6
+ import java .io .IOException ;
7
+
8
+ /**
9
+ * @author Igor Polevoy on 12/10/15.
10
+ */
11
+ public class Issue193Spec extends RequestSpec {
12
+
13
+ @ Test //https://github.com/javalite/activeweb/issues/244
14
+ public void shouldSanitizeBadContent () throws IOException , ServletException {
15
+ request .setServletPath ("/issue193" );
16
+ request .setMethod ("GET" );
17
+
18
+ dispatcher .doFilter (request , response , filterChain );
19
+ String result = response .getContentAsString ();
20
+ a (result ).shouldBeEqual ("ok" );
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments