Endpoints using Vraptor

Asked

Viewed 25 times

0

I have a problem here but I do not know if it gives p/ solve . I have a method that has many parameters so I made a kind of filter, and it was like this :

@Get("")
        public void findByFilter(Filtro filtro) {
    //faz algo
    }

the point is that in an application ,Spring for example, when needed to search something by name I would send the following URL : localhost:8080/api? name=xxx but using Vraptor I am obliged to use: localhost:8080/api? filter.name=xxx .

My question is whether there is a way to get Vraptor to understand the URL as Spring, and that my Front-end does not need to know the name of the variable I chose in order to make a request.

1 answer

0


Hello, you need to set on Get what you want to pick up, example.

@Get("/{todo}")
public void getOne(Todo todo) {
    result.use(Results.json()).withoutRoot()
          .from(todoRepository.find(todo.getId())).serialize();
}

NOTE: You will not need to use Querystrings, if by chance this is a requirement I believe you will have to pass parameter by parameter.

Refrencia: http://www.vraptor.org/pt/cookbook/utilizando-angularjs-vraptor4/

  • Had read this topic, unfortunately does not match the architecture of the project I’m inserted, but helped understand how the tool works, thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.