Category Archives: Development

Maven error 501 (HTTPS)

If you installed an old version of Netbeans, it is possible that you are getting error 501 (see this post). This is because the included maven version in Netbeans is too old.

Step 1 – Install maven

sudo apt install maven

Step 2 – Configure netbeans

Options -> java -> Maven: set up : /usr/share/maven

CORS – test with curl

Send an OPTIONS message and check Access-Control-Allow-Origin is in the response:

curl -X OPTIONS 'https://domain/path/file.png' -H "Origin: http://yoursitedomain" -H "Access-Control-Request-Method: POST" -H "Access-Control-Request-Headers: X-Requested-With"  --verbose 

Or if you want to ignore the output:

curl -X OPTIONS 'https://domain/path/file.png' -H "Origin: https://yoursitedomain" -H "Access-Control-Request-Method: POST" -v -o /dev/null

Spring vs Jax-RS annotations

SPRING ANNOTATIONJAX-RS ANNOTATION
@RequestMapping(path = “/troopers”@Path(“/troopers”)
@PostMapping@POST
@PutMapping@PUT
@GetMapping@GET
@DeleteMapping@DELETE
@ResponseBodyN/A
@RequestBodyN/A
@PathVariable(“id”)@PathParam(“id”)
@RequestParam(“xyz”)@QueryParam(‘xyz”)
@RequestParam(value=”xyz”)@FormParam(“xyz”)
@RequestMapping(produces = {“application/json”})@Produces(“application/json”)
@RequestMapping(consumes = {“application/json”})@Consumes(“application/json”)