Is it possible to map parameters to a path in Spring Rest? -


i've legacy system query parameters used determine class/method request using simple in-house framework. e.g.

/endpoint?product=foo&action=bar&amount=1.0 /endpoint?product=foo&action=baz&amount=1.0 

and i'd map actions product 1 class plumbing can simplified, e.g.

@controller @requestmapping("/endpoint/foo/**") public class foocontroller {    @autowire   private fooproductservice s; // 1 of many beans have wired lots of classes    @requestmapping("/bar")   public void bar(@pathvariable string amount, model model) {         // implementation omitted   }   @requestmapping("/baz")   public void baz(@pathvariable string amount, model model) {         // implementation omitted   } 

}

it's published api can't change public api -> urls cannot change.

i thought perhaps done using configuration, aspect or custom framework out own annotations.

i believe can product=foo&action=bar&amount=1.0

@requestmapping(value = "product={productname}&action={someaction}&amount={value}", method=requestmethod.get) something(@pathvariable string productname, @pathvariable string someaction, @pathvariable string value)     if(someaction.equals("bar")) {         //do bar     }      if(someaction.equals("baz")) {         //do baz     }  } 

hth


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -