Coding assistance for REST development
Besides the common Web services support, IntelliJ IDEA provides the following facilities for developing RESTful Web services:
-
Code completion for MIME type
-
Dedicated HTTP Client in IntelliJ IDEA Code Editor
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. |
HTTP Client in Code Editor
The dedicated HTTP client in IntelliJ IDEA code editor provides the following facilities for working with HTTP requests:
-
Composing and executing requests
-
Displaying server responses and the executed requests history
-
Completing the HTTP request parts from the
@Path
and@Produces
annotations specified in the Java code
Change in the Java code | Change in the HTTP request in editor |
---|---|
@Path annotation is updated. |
The contents of the |
@Produces annotation is updated. |
The contents of the |