This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 212869

Summary: Usage of javax.ws.rs.core.MediaType in the REST WebServices
Product: webservices Reporter: Martin Fousek <marfous>
Component: RESTAssignee: Milan Kuchtiak <mkuchtiak>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 7.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Martin Fousek 2012-05-23 05:12:58 UTC
Product Version: NetBeans IDE Dev (Build 20120523-b83a53af631e)
Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; en_US (nb)

RESTful java client uses "javax.ws.rs.core.MediaType.APPLICATION_JSON" and "javax.ws.rs.core.MediaType.APPLICATION_XML" to get message in appropriate format from the WebService. As an opposite is designed the REST WS where are generated codes like:
@PUT
@Override
@Consumes({"application/xml", "application/json"})
public void edit(Message entity) {
    super.edit(entity);
}

It should probably look like this piece of code to preserve better coding standards - in the same way as in the Java Client.
@PUT
@Override
@Consumes({javax.ws.rs.core.MediaType.APPLICATION_XML, javax.ws.rs.core.MediaType.APPLICATION_JSON})
public void edit(Message entity) {
    super.edit(entity);
}
Comment 1 Denis Anisimov 2012-05-23 08:43:19 UTC
It's just a question of form. So it is not P3.
Comment 2 Jan Stola 2015-04-28 14:41:47 UTC
Generated REST Web Services use the constants of MediaType instead of string literals by now.

Modified files: https://hg.netbeans.org/web-main/rev/769d26b7ebd1
Comment 3 Quality Engineering 2015-04-29 02:31:26 UTC
Integrated into 'main-silver', will be available in build *201504290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/769d26b7ebd1
User: Jan Stola <jstola@netbeans.org>
Log: #212869: Using the constants of javax.ws.rs.core.MediaType instead of string literals in REST Web Services