|
17 | 17 |
|
18 | 18 | import com.blade.ioc.bean.BeanDefine;
|
19 | 19 | import com.blade.kit.IocKit;
|
| 20 | +import com.blade.mvc.handler.RouteHandler; |
20 | 21 | import com.blade.mvc.http.Body;
|
21 | 22 | import com.blade.mvc.http.Request;
|
22 | 23 | import com.blade.mvc.http.Response;
|
@@ -46,6 +47,7 @@ public class RouteContext {
|
46 | 47 | private Request request;
|
47 | 48 | private Response response;
|
48 | 49 | private Object[] routeActionParameters;
|
| 50 | + private boolean abort; |
49 | 51 |
|
50 | 52 | private static final String LAMBDA_IDENTIFY = "$$Lambda$";
|
51 | 53 |
|
@@ -521,25 +523,35 @@ public Object[] routeParameters() {
|
521 | 523 | return this.routeActionParameters;
|
522 | 524 | }
|
523 | 525 |
|
| 526 | + public void abort() { |
| 527 | + this.abort = true; |
| 528 | + } |
| 529 | + |
| 530 | + public boolean isAbort() { |
| 531 | + return this.abort; |
| 532 | + } |
| 533 | + |
524 | 534 | public void initRoute(Route route) {
|
525 | 535 | this.request.initPathParams(route);
|
526 | 536 | this.route = route;
|
527 |
| - |
528 |
| - boolean singleton = IocKit.isSingleton(route.getTargetType()); |
529 |
| - |
530 |
| - if (singleton) { |
531 |
| - BeanDefine beanDefine = WebContext.blade().ioc().getBeanDefine(route.getTargetType()); |
532 |
| - if(beanDefine.isFieldHasPrototype()){ |
533 |
| - // reset initialize |
534 |
| - IocKit.injection(WebContext.blade().ioc(), beanDefine); |
535 |
| - } else { |
536 |
| - Object target = WebContext.blade().ioc().getBean(route.getTargetType()); |
537 |
| - this.route.setTarget(target); |
538 |
| - } |
539 |
| - } else { |
540 |
| - Object target = WebContext.blade().ioc().createBean(route.getTargetType()); |
541 |
| - this.route.setTarget(target); |
542 |
| - } |
| 537 | +// if (null != route.getTarget() && route.getTargetType().equals(RouteHandler.class)) { |
| 538 | +// return; |
| 539 | +// } |
| 540 | +// boolean singleton = IocKit.isSingleton(route.getTargetType()); |
| 541 | +// |
| 542 | +// if (singleton) { |
| 543 | +// BeanDefine beanDefine = WebContext.blade().ioc().getBeanDefine(route.getTargetType()); |
| 544 | +// if (beanDefine.isFieldHasPrototype()) { |
| 545 | +// // reset initialize |
| 546 | +// IocKit.injection(WebContext.blade().ioc(), beanDefine); |
| 547 | +// } else { |
| 548 | +// Object target = WebContext.blade().ioc().getBean(route.getTargetType()); |
| 549 | +// this.route.setTarget(target); |
| 550 | +// } |
| 551 | +// } else { |
| 552 | +// Object target = WebContext.blade().ioc().createBean(route.getTargetType()); |
| 553 | +// this.route.setTarget(target); |
| 554 | +// } |
543 | 555 | }
|
544 | 556 |
|
545 | 557 | public void injectParameters() {
|
|
0 commit comments