Die folgenden drei sind erforderlich
           <groupId>org.glassfish.jersey.core</groupId>
           <artifactId>jersey-client</artifactId>
           <version>2.27</version>
       
           <groupId>org.glassfish.jersey.media</groupId>
           <artifactId>jersey-media-json-jackson</artifactId>
           <version>2.26</version>
       
           <groupId>org.glassfish.jersey.inject</groupId>
           <artifactId>jersey-hk2</artifactId>
           <version>2.26</version>
  
Nicht genug
java.lang.ClassNotFoundException: org.glassfish.jersey.internal.l10n.LocalizableMessageFactory$ResourceBundleSupplier
Ich verstehe diesen Fehler nicht
✩ Ich möchte die API von http: // localhost: 8080 / test / api1 aufrufen
public void excute(RequestData req) {
		
		String result = ClientBuilder.newClient()
				//Die URL, unter der das Kooperationsziel festgelegt wird
				.target("http://localhost:8080")
				//Wo sich der Pfad abhängig vom Verbindungsziel ändert
				.path("/test/api1")
				//Wo kann man entscheiden, ob man im XML- oder JSON-Format anfordert?
                //Geben Sie dies für xml → APPLICATION an_XML_TYPE
				.request(MediaType.APPLICATION_JSON_TYPE)
				//Daten eintauchen
                //Geben Sie an, in welchem Format die Antwort mit MediaType dieses Mal JSON empfangen wird
				.post(Entity.entity(req, MediaType.APPLICATION_JSON), String.class);
		//Antwort auf Standardausgabe anzeigen
		System.out.println(result);
	}
        Recommended Posts