-
Notifications
You must be signed in to change notification settings - Fork 0
condingame
Kais NAFFOUTI edited this page Jun 11, 2018
·
1 revision
package test;
abstract class Animal<Dog,Cat> {
String name;
Animal(String name){
this.name = name;
}
public String getName(){
return name;
}
}
class Dog extends Animal{
Dog(String name) {
super(name);
// TODO Auto-generated constructor stub
}}
class Cat extends Animal{
Cat(String name) {
super(name);
// TODO Auto-generated constructor stub
}}
public class Application {
static String getAnimalName(Animal name){
return name.getName();
}
public static void main (String args[]){
Dog sammy = new Dog("Smmy");
Animal smokey = new Cat("Smokey");
System.out.println(Application.getAnimalName(sammy));
System.out.println(Application.getAnimalName(smokey));
}
}
@OPTIONS @Path("/getsample") public Response getOptions() { return Response.ok() .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build(); }
dans le web services
If non of this work, try to exchange the "" provided for "Access-Control-Allow-Origin" header with your custom domain where you access this resource. I.g. If you call this from http://localhost::8080 use something like this ("Access-Control-Allow-Origin", "http://localhost:8080") instead of asterisk ""