Restler is a library that automatically generates a client for a web service at run time, by analyzing the respective annotated Spring controller interface

Related tags

Spring Boot restler
Overview

Build Status Maven Central

Restler

Overview

Restler is a library that automatically generates a client for a web service at run time, by analyzing the respective annotated Spring controller interface. Restler may help you remove HTTP-specific boilerplate from your integration tests, microservices and thirdparty HTTP API clients.

EPA warning: Restler currently is in early public access stage and it is neither feature complete, tested in production or backward compatible

Features

  • Easily extensible architecture
  • Custom authentication, authorization and errors mapping strategies
  • Support of form-based, http basic, cookie-based and generic header-based authentication
  • Support of async controllers through methods returning Future, DefferedResult or Callable objects
  • Experemental Spring Data REST support

Simple Usage Example

Suppose you have the following interface on the server:

/** 
  * An annotated Spring controller interface
  */
@Controller
@RequestMapping("greeter")
public interface Greeter {

	@RequestMapping("greetings/{language}")	
	String getGreeting(@PathVariable String language, @RequestParam(defaultValue = "Anonymous") String name); 

}

Then in your client you can invoke the getGreeting method of the remote service using the following code snippet:

Service service = new Restler("https://www.example.com/api", new SpringMvcSupport()).build();
Greeter greeter = service.produceClient(Greeter.class);
String greeting = greeter.getGreeting("en","Buddy"); // the result of https://www.example.com/api/greeter/greetings/en?name=Buddy call
Comments
  • Provide ability to use different http clients

    Provide ability to use different http clients

    Now the project are statically bound to spring's http client. We could introduce or own abstractions in core module and add few executors modules (i.e. spring, apache, spray etc.)

    enhancement design 
    opened by d-r-q 2
  • Controllers code generation

    Controllers code generation

    Create tool, which can be plugged into build systems to generate spring/jax-rs controllers by service interface.

    For example for such service

    public interface Users {
    
        UUID createUser(User user);
    
    }
    

    That tool should generate such spring controller:

    @RestController
    public interface UsersController {
    
        @RequestMapping("/users", method = RequestMethod.POST)
        UUID createUser(@RequestBody User user);
    
    }
    
    enhancement major-feature 
    opened by d-r-q 1
  • Inject CallExecutor into FormAuth

    Inject CallExecutor into FormAuth

    Currently CallExecutor is injected into FormAuth through constructor, so user is required to instantiate it somehow. Find a way to free user from this requirement.

    enhancement design investigation 
    opened by d-r-q 1
  • Fix supported stereotypes check

    Fix supported stereotypes check

    Now check for supported stereo types (i.e. @Controller) restler-core/src/main/java/org/restler/client/CGLibClientFactory.java is commented out because it fails to for Spring Data repositories exposed with Spring Data Rest. We cannot simple add RepositoryRestResource to supported types, because it is containted in separate and not essential for restler artifact. Probably we need to develop modules system and then reenable this check

    question design cosmetics 
    opened by d-r-q 1
  • Introduce consistent scheme to setters naming in ServiceBuilder

    Introduce consistent scheme to setters naming in ServiceBuilder

    Now in ServiceBuilder bunch of methods are started with "use" and bunch just repeat underlying field name. We have to develop consistent scheme for setters naming and refactor ServiceBuilder according to it

    cosmetics 
    opened by d-r-q 1
  • Redesign invocation executors

    Redesign invocation executors

    Now we have strange situation, when usual requests are executed by implementation of ServiceMethodInvocationExecutor, when for requests returning DefferedResult or Callable, there are custom wrappers which delegates call to ServiceMethodInvocationExecutor.

    We need to redesign this part of system to be consistent and to allow users to provide custom invocation executors.

    enhancement design 
    opened by d-r-q 1
  • Implement own ResponseEntity type

    Implement own ResponseEntity type

    Now the HttpRequestExextuor returns spring's ResponseEntity but it's better to be decoupled from spring, so we need to introduce own abstraction for it

    enhancement design 
    opened by d-r-q 1
  • Minor refactorings for next dev. iteration

    Minor refactorings for next dev. iteration

    • [x] Remove Optional fields everywhere
    • [x] Move Pair class to restler-core module
    • [x] Update comment for CgLibClientFactory
    • [x] Move canHandle from DefaultCoreModule to CoreModule
    • [x] Convert jar-executor-plugin to kotlin
    • [x] Fix server stopping when tests failed
    enhancement cosmetics 
    opened by d-r-q 0
  • Improve auth support

    Improve auth support

    Improve auth support

    • Eliminate possibility to create Restler instance with authorization strategy, but without authentication strategy
    • Replace cookieBasedAuthentication method with formAuthentication
    • Merge HttpBasicAuthorizationStrategy into HttpBasicAuthenticationStrategy
    • Add more documentation Closes #95
    opened by d-r-q 0
  • Unused Spring MVC Controller path variables

    Unused Spring MVC Controller path variables

    Currently if path variable not used at all, Restler rejects controllers, but users may want to have variables only in urls. We should think how we can support this case. Problem example:

    @RequestMapping("{notUsed}")
    public void test();
    
    enhancement cosmetics 
    opened by d-r-q 0
Owner
Excelsior LLC
We make Excelsior JET, a compliant Java SE JVM with AOT compiler. These are our open source projects.
Excelsior LLC
A library that automatically generates and manages configuration files based on classes.

sc-cfg SC-CFG is a simple, yet powerful library that automatically generate configuration files based on your classes. Compatible with Java 8+ and Kot

null 10 Nov 28, 2022
Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

中文README传送门 What is Auto-Unit-Test-Case-Generator Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During te

TRaaS 108 Dec 22, 2022
Hi, Spring fans! In this installment, we're going to look at some the C in M-V-C and their representation in Spring's `@Controller` types!

@Controllers Hi, Spring fans! In this installment, we're going to look at some the C in M-V-C and their representation in Spring's @Controller types!

Spring Tips 22 Nov 19, 2022
👮🏻‍♀️ simple k8s admission controller using spring boot

spring admission controller Spring boot를 이용해 만든 간단한 Kubernetes admission controller 입니다. Admission controller의 Validating webhook을 이용하여 Pod의 생성을 제한합니다

Bobae Kim 2 Dec 22, 2021
Controller software for the PCPanel (getpcpanel.com) devices.

PCPanel Software Controller software for the PCPanel devices. This repository is based on the decompiled source code of the original app. The parts th

Niels van de Weem 34 Dec 31, 2022
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
Critter Chronologer a Software as a Service application that provides a scheduling interface for a small business that takes care of animals

Critter Chronologer a Software as a Service application that provides a scheduling interface for a small business that takes care of animals. This Spring Boot project will allow users to create pets, owners, and employees, and then schedule events for employees to provide services for pets.

Rasha Omran 1 Jan 28, 2022
该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的线上博客项目/企业大型商城系统/前后端分离实践项目等,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。

Spring Boot Projects 该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的前

十三 4.5k Dec 30, 2022
Generates and keeps up-to-date your Spring Boot applications' Let's Encrypt or other ACME compliant SSL certificates.

Generates and keeps up-to-date your Spring Boot applications' Let's Encrypt or other ACME compliant SSL certificates. Pure Java in a single file of library code. An automated embedded alternative to Certbot and docker-sidecars. No JVM restart is needed on certificate update.

Valentyn Berezin 12 Nov 18, 2022
Spring REST service built with Spring initializr and Spring Data.

Spring REST Service Generated with start.spring.io, using Spring Data. Documented using Spring REST Docs. Spring Initializr - Generate new Spring Rest

null 1 Jan 28, 2022
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

OpenAPI Generator Master (5.4.x): 6.0.x (6.0.x): ⭐ ⭐ ⭐ If you would like to contribute, please refer to guidelines and a list of open tasks. ⭐ ⭐ ⭐ ‼️

OpenAPI Tools 14.8k Dec 30, 2022
A web interface for viewing market data from Project Serum, on the Solana blockchain.

serum-data A web interface for viewing market data from Project Serum, on the Solana blockchain. Building Requirements (if not using Docker) Java 17 M

Michael Morrell 36 Jan 1, 2023
Spring Boot JdbcTemplate example with SQL Server: CRUD Rest API using Spring Data JDBC, Spring Web MVC

Spring Boot JdbcTemplate example with SQL Server: Build CRUD Rest API Build a Spring Boot CRUD Rest API example that uses Spring Data Jdbc to make CRU

null 7 Dec 20, 2022
Buried Barrels is a simple vanilla+ mod that generates hidden barrels throughout the world.

Buried Barrels is a simple vanilla+ mod that generates hidden barrels throughout the world. Special maps leading to these treasures can be found on mo

Aurel 2 Apr 7, 2022
Generates a Proguard mapping file for use in obfuscating your Java projects.

Reaper Generates a Proguard mapping file for use in obfuscating your Java projects. Features Automatically checks for duplicate names. Interactive, in

Nox 12 Dec 29, 2022
EssentialClient is a client side mod originally forked from Carpet Client for 1.15.2 that implements new client side features

EssentialClient EssentialClient is a client side only mod originally forked from Carpet Client for 1.15.2 that implements new client side features. Th

null 62 Jan 3, 2023
Minecraft configurable plugin , which sends messages the first time a player logs into the server or the next time they log in.

JoinMessages Minecraft configurable plugin , which sends messages the first time a player logs into the server or the next time they log in or leave.

ᴠᴀʟᴇɴᴛɪɴ ᴢʜᴇʟᴇᴠ 6 Aug 30, 2022
Just-In-Time Access is an AppEngine application that lets you manage just-in-time privileged access to Google Cloud projects.

Just-In-Time Access Just-In-Time Access is an AppEngine application that lets you manage just-in-time privileged access to Google Cloud projects. Syno

Google Cloud Platform 36 Jan 3, 2023
Spring Initializr interface over Discord

Spring Initializr interface over Discord. Initialize your new Spring Boot project right in the app

Mikhail Titov 1 Mar 7, 2022