Title: Less mess up potential when registering middleware and controllers by making the order of registration irrelevant · Issue #2 · JavaWebStack/web-framework · GitHub
Open Graph Title: Less mess up potential when registering middleware and controllers by making the order of registration irrelevant · Issue #2 · JavaWebStack/web-framework
X Title: Less mess up potential when registering middleware and controllers by making the order of registration irrelevant · Issue #2 · JavaWebStack/web-framework
Description: Is your feature request related to a problem? Please describe. When the controllers are registered before the middlewares the middlewares don't work or kick into action. I was confused about this and this is a potential for frustration a...
Open Graph Description: Is your feature request related to a problem? Please describe. When the controllers are registered before the middlewares the middlewares don't work or kick into action. I was confused about this a...
X Description: Is your feature request related to a problem? Please describe. When the controllers are registered before the middlewares the middlewares don't work or kick into action. I was confused about th...
Opengraph URL: https://github.com/JavaWebStack/web-framework/issues/2
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Less mess up potential when registering middleware and controllers by making the order of registration irrelevant","articleBody":"**Is your feature request related to a problem? Please describe.**\r\nWhen the controllers are registered before the middlewares the middlewares don't work or kick into action. I was confused about this and this is a potential for frustration and wasted time debugging.\r\n\r\n**Describe the solution you'd like**\r\nThe order of registration becomes irrelevant.\r\n\r\n**Describe alternatives you've considered**\r\nProviding informative information via the logger on at least warning level.\r\n\r\n**Additional context**\r\n\r\nWorking code sample:\r\n\r\n```\r\n public void setupServer(HTTPServer httpServer) {\r\n httpServer.middleware(\"auth\", new AuthenticationMiddleware());\r\n httpServer.beforeAny(\"/api\", new AuthenticationMiddleware());\r\n httpServer.controller(HttpController.class, RootController.class.getPackage());\r\n }\r\n```\r\n\r\nUnexpetedly broken sample:\r\n\r\n```\r\n public void setupServer(HTTPServer httpServer) {\r\n httpServer.controller(HttpController.class, RootController.class.getPackage());\r\n httpServer.middleware(\"auth\", new AuthenticationMiddleware());\r\n httpServer.beforeAny(\"/api\", new AuthenticationMiddleware());\r\n }\r\n```","author":{"url":"https://github.com/TimothyGillespie","@type":"Person","name":"TimothyGillespie"},"datePublished":"2021-03-02T01:29:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2/web-framework/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:43cf51be-81c6-6139-4a09-c1ab0aa37b12 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C778:335FF6:A889340:D9D549A:697F18C8 |
| html-safe-nonce | 9a79ca1a15b2f1d9deabdc1f6c78ea7e7b73f70b5c6c5376e69e29699599a7b2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzc4OjMzNUZGNjpBODg5MzQwOkQ5RDU0OUE6Njk3RjE4QzgiLCJ2aXNpdG9yX2lkIjoiMzk4MDk4MDMzNjUwMTEyNzEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6033bf7892370bf0ec0cd3f5e9037a9dd5ac052f5cbd1fec75aa4dc4c028da8e |
| hovercard-subject-tag | issue:819506872 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaWebStack/web-framework/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/862e3f7ddf2fed022afdc62a2c0cb6aaa36486e4fc8d067864c79acdd41db45c/JavaWebStack/web-framework/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/862e3f7ddf2fed022afdc62a2c0cb6aaa36486e4fc8d067864c79acdd41db45c/JavaWebStack/web-framework/issues/2 |
| og:image:alt | Is your feature request related to a problem? Please describe. When the controllers are registered before the middlewares the middlewares don't work or kick into action. I was confused about this a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TimothyGillespie |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaWebStack/web-framework git https://github.com/JavaWebStack/web-framework.git |
| octolytics-dimension-user_id | 73674659 |
| octolytics-dimension-user_login | JavaWebStack |
| octolytics-dimension-repository_id | 308483692 |
| octolytics-dimension-repository_nwo | JavaWebStack/web-framework |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 308483692 |
| octolytics-dimension-repository_network_root_nwo | JavaWebStack/web-framework |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width