THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
DefectAsset Class
Code Block | ||||
---|---|---|---|---|
| ||||
@Asset public class DefectAsset { public Defect defect; public DefectAsset(Defect defect) { this.defect = defect; } @Produces("application/xml") public Defect getDefect() { return this.defect; } @Produces("text/html") public String getDefectAsHtml() { String html = ...; return html; } @Produces("application/atom+xml") public AtomEntry getDefectAsAtom() { AtomEntry entry = ...; return entry; } @Consumes("application/xml") public void setDefect(Defect defect) { this.defect = defect; } } |
DefectResource Class
Code Block | ||||
---|---|---|---|---|
| ||||
@Path("defects/\{id\}") public class DefectResource { @GET public DefectAsset getDefect(@PathParam("id") String id) { return new DefectAsset(defects.get(id)); } @PUT public DefectAsset updateDefect(DefectAsset defectAsset, @PathParam("id") String id) { defects.put(id, defectAsset.getDefect()); return defectAsset; } } |
...