This library delivers a annotation and adds a HandlerMethodArgumentResolver to the Spring MVC framework.
Example for Maven:
<dependency>
<groupId>de.is24.spring</groupId>
<artifactId>base64-url-decoder</artifactId>
<version>1.0</version>
</dependency>
Annotate your parameters with the @DecodedUri annotation in a MVC Controller according to this example:
@Controller
public class TestController {
@RequestMapping("/test")
public String test(@DecodedUri URI uri) {
return url.toString();
}
}
And register the Base64DecodingArgumentResolver in to your MVC context:
@Configuration
public class Web extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new UrlResolvingHandlerMethodArgumentResolver());
}
}
MIT