User Tools

Site Tools


java:jax-rs

Konfiguration/Setup

  • Netbeans 6.9
    • New Project “Java Web” > “Web Application”
    • Enable CDI

New Class “TaskResource”

New Class “TaskService”

Testing

curl

Optionen:

Option Bedeutung
-H Header setzen, z.B. “Accept: text/html” oder “Content-Type: application/x-www-form-urlencoded”
-G GET request
-X <verb> Andere Methode als GET benutzen, z.B. PUT
-d “Daten” übertragen oder @file Inhalt von Datei
–insecure laxe SSL Prüfungen (hostname-verification, Zertifikat, …)
-o <file> Output in Datei schreiben
-v verbose (sent/received headers)
-x <proxy:port> Proxy benutzen

# PUT
curl -X PUT -d @TaskID3.json -H "Content-Type: application/json" -v http://localhost:8080/Rest4Task/res/tasks/ID3
# POST
curl -X POST -d @TaskID3.json -H "Content-Type: application/json" -v http://localhost:8080/Rest4Task/res/tasks

soapUI

Expand Property w/ a JavaScript snippet:

// generate 0-trailed random number from 7 to 14 (just an example)
${=('00' + (Math.floor(Math.random() * (14 - 7 + 1)) + 7)).slice(-2)}

Sonstige Tools

java/jax-rs.txt · Last modified: 2013/11/13 13:16 by hgoebl