/spring-base64-url-decoder

Adds a MVC parameter annotation and a HandlerMethodArgumentResolver to enable decoding Base64 encoded URL parameters.

Primary LanguageJavaMIT LicenseMIT

Spring Base64 Url Decoder

Build Status Coverage Status Maven Central

This library delivers a annotation and adds a HandlerMethodArgumentResolver to the Spring MVC framework.

Binaries

Example for Maven:

    <dependency>
      <groupId>de.is24.spring</groupId>
      <artifactId>base64-url-decoder</artifactId>
      <version>1.0</version>
    </dependency>

Usage

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());
  }
}

License

MIT