Coding Assistance for REST Development
This feature is supported in the Ultimate edition only.
Besides the common Web services support, IntelliJ IDEA provides the following facilities for developing RESTful Web services:
Code Inspection and Quick Fixes
IntelliJ IDEA supports code inspections and suggests quick fixes in the following cases:
Issue | Default Quick Fix |
---|
Inconsistency between a method annotation and the method return type: a @GET annotated method returns void value. | Change to String. |
Resource methods errors. | Remove @Path annotation. |
Incorrect parameter type. | Validation for parameters annotated with @QueryParam or @PathParam annotations. |
@DefaultValue issues. | @GET
public String get(@DefaultValue("33.5") @QueryParam("str") int str){
return "Hello";
}
DefaultValue is marked red with the description "Can't convert to int". |
Rest @Path and @PathParam annotations inspections. |
Rest References resolve problems. | References in @PathParam annotations are resolved to templates in @Path annotations |
This method should have only one HTTP method designator. | Example: @GET
@POST
public String get(){
return "Hello";
}
@POST is marked red. |
WADL configuration errors. |
REST Client Tool Window
Dedicated REST Client tool window supports:
- Constituting URL addresses semiautomatically from the specified Deployment point and the
@Path
annotation. - Submitting requests to the server.
- Displaying server responses in the Response tab.
- Code integration between the Java code and the contents of the REST Client window controls.
Change in the Java code | Change in the REST Client tool window |
---|
@Path annotation is updated. | The contents of the Path to resource drop-down list change. |
@Produces annotation is updated. | The contents of the Accept drop-down list change. |
Last modified: 18 July 2017