File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
http-generator-core/src/main/java/io/avaje/http/generator/core
tests/test-jex/src/main/java/org/example/web Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -187,8 +187,8 @@ private void writeClientAdapter(ControllerReader reader) {
187
187
188
188
try {
189
189
if (reader .beanType ().getInterfaces ().isEmpty ()
190
- && "java.lang.Object" .equals (reader .beanType ().getSuperclass ().toString ())) {
191
- new TestClientWriter (reader ).write ();
190
+ && "java.lang.Object" .equals (reader .beanType ().getSuperclass ().toString ())
191
+ && new TestClientWriter (reader ).write ()) {
192
192
clientFQNs .add (reader .beanType ().getQualifiedName ().toString () + "TestAPI" );
193
193
}
194
194
} catch (final IOException e ) {
Original file line number Diff line number Diff line change @@ -54,12 +54,13 @@ protected String initPackageName(String originName) {
54
54
return dp > -1 ? originName .substring (0 , dp ) : null ;
55
55
}
56
56
57
- void write () {
58
- if (methods .isEmpty ()) return ;
57
+ boolean write () {
58
+ if (methods .isEmpty ()) return false ;
59
59
writePackage ();
60
60
writeImports ();
61
61
writeClassStart ();
62
62
writeAddRoutes ();
63
+ return true ;
63
64
}
64
65
65
66
protected void writePackage () {
Original file line number Diff line number Diff line change
1
+ package org .example .web ;
2
+
3
+ import io .avaje .http .api .Controller ;
4
+ import io .avaje .http .api .ExceptionHandler ;
5
+ import io .avaje .http .api .Filter ;
6
+ import io .avaje .http .api .Produces ;
7
+ import io .avaje .jex .http .Context ;
8
+ import io .avaje .jex .http .HttpFilter .FilterChain ;
9
+
10
+ @ Controller
11
+ public class ErrorController {
12
+
13
+ @ Filter
14
+ void filter (FilterChain chain ) {
15
+ // do nothing
16
+ chain .proceed ();
17
+ }
18
+
19
+ @ ExceptionHandler
20
+ String exception (RuntimeException ex ) {
21
+ return "Err: " + ex ;
22
+ }
23
+
24
+ @ Produces (statusCode = 501 )
25
+ @ ExceptionHandler
26
+ HelloDto exceptionCtx (IllegalAccessException ex , Context ctx ) {
27
+ return null ;
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments