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) {
187187
188188 try {
189189 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 ()) {
192192 clientFQNs .add (reader .beanType ().getQualifiedName ().toString () + "TestAPI" );
193193 }
194194 } catch (final IOException e ) {
Original file line number Diff line number Diff line change @@ -54,12 +54,13 @@ protected String initPackageName(String originName) {
5454 return dp > -1 ? originName .substring (0 , dp ) : null ;
5555 }
5656
57- void write () {
58- if (methods .isEmpty ()) return ;
57+ boolean write () {
58+ if (methods .isEmpty ()) return false ;
5959 writePackage ();
6060 writeImports ();
6161 writeClassStart ();
6262 writeAddRoutes ();
63+ return true ;
6364 }
6465
6566 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