JavaWebStack / JavaWebStack/web-framework

Less mess up potential when registering middleware and controllers by making the order of registration irrelevant

Aberta
#2 0 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Java
Estrelas
0
Forks
0
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

**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 and wasted time debugging.

**Describe the solution you'd like**
The order of registration becomes irrelevant.

**Describe alternatives you've considered**
Providing informative information via the logger on at least warning level.

**Additional context**

Working code sample:

```
public void setupServer(HTTPServer httpServer) {
httpServer.middleware("auth", new AuthenticationMiddleware());
httpServer.beforeAny("/api", new AuthenticationMiddleware());
httpServer.controller(HttpController.class, RootController.class.getPackage());
}
```

Unexpetedly broken sample:

```
public void setupServer(HTTPServer httpServer) {
httpServer.controller(HttpController.class, RootController.class.getPackage());
httpServer.middleware("auth", new AuthenticationMiddleware());
httpServer.beforeAny("/api", new AuthenticationMiddleware());
}
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Comece pelos pontos de entrada de registro do HTTPServer mostrados em setupServer: controller, middleware e beforeAny. Rastreie como a ordem de registro afeta a ativação do middleware e defina a conclusão de modo que ambos os exemplos de código apliquem o middleware de forma equivalente; considere o log de aviso solicitado como alternativa se a independência da ordem não for viável.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
java
Domínio
backend
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.