Open Emerjoin opened 7 years ago
@Mapping("/order") public class OrderController extends Controller { public void cancel(@Map("id") String id) throws MvcException{ this.callView(); } public void pay(@Map("id") String id, @Map("amt") Optional<Double> amount) { if(amount.isPresent){ double amt = amount.get(); //Do partial payment here }else{ //Do full payment here } } }
The action order/pay would return 200 for the following invocation
GET order/pay?id=10&amt=1200 //The values match the declared types
It would return 404 for the following invocations
GET order/pay?id=10&amt=abc //The amt value is not a valid double
Why to we need Get parameters mapping?
The action order/pay would return 200 for the following invocation
It would return 404 for the following invocations