title: post request in Unirest Java result on a 302 http result
body: <p>I m training my self on creating a restful server and a desktop java based client.</p>
  
  <p>my backend is Spring Boot based, I have the following controller : </p>
  
  <pre><code>@RestController
  @RequestMapping(NiveauAccessController.URL)
  public class NiveauAccessController extends GenericController{
  
  public static final String URL = "/acl";
  
  @Autowired
  private NiveauAccessRepository niveauAccessRepository;
  
  @PostMapping
  private ServerResponse createACL(
              @RequestParam("aclTitle") final String aclTitle,
              @RequestParam("roles") final List&lt;String&gt; roles 
  ){
      if(isSessionValid()){
          final MNG_NIVEAU_ACCEE mng_niveau_accee = new MNG_NIVEAU_ACCEE();
          mng_niveau_accee.setAclTitle(aclTitle);
          List&lt;Role&gt; enumRoles = new ArrayList();
          roles.stream().forEach(role-&gt;{
              enumRoles.add(Role.valueOf(role));
          });
          mng_niveau_accee.setRoles(enumRoles);
          niveauAccessRepository.save(mng_niveau_accee);
          initSuccessResponse(mng_niveau_accee);
          return serverResponse;
      }
      initFailLoginResponse();
      return serverResponse;
  }
  .
  .
  .
  }
  </code></pre>
  
  <p>for my java client I m using this sample code to send a post request over my server :</p>
  
  <pre><code>@FXML
  private void doAdd(ActionEvent event) throws UnirestException {
      if (titleACL.getText().isEmpty()) {
          Alert alert = new Alert(Alert.AlertType.ERROR);
          alert.initModality(Modality.WINDOW_MODAL);
          alert.initOwner(((Node) event.getSource()).getScene().getWindow());
          alert.setContentText("Veuillez remplir le champ");
          alert.showAndWait();
          titleACL.requestFocus();
          return;
      }
      String title = titleACL.getText();
      Predicate&lt;? super JFXCheckBox&gt; selectedCheckboxes = checkbox -&gt; {
          return checkbox.isSelected();
      };
      List&lt;JFXCheckBox&gt; selectedCheckBoxesList = observableCheckBoxes.values().stream().filter(selectedCheckboxes).collect(Collectors.toList());
      final List&lt;String&gt; roles = new ArrayList&lt;&gt;();
      selectedCheckBoxesList.stream().forEach(checkbox -&gt; {
          roles.add(checkbox.getText());
      });
  
      HttpResponse&lt;String&gt; asString = Unirest.post(ACL_URL)
              .header("accept", "application/json")
              .field("aclTitle", title)
              .field("roles", roles)
              .asString();
  
      System.out.println(asString.getStatus());
      System.out.println(asString.getHeaders().values());
      if (asString.getStatus() == 200) {
      }
  }
  </code></pre>
  
  <p>my output is :</p>
  
  <blockquote>
    <p>302</p>
    
    <p>[[0], [Thu, 10 May 2018 13:30:05 GMT], [<a href="https://localhost:8443/acl]]" rel="nofollow noreferrer">https://localhost:8443/acl]]</a></p>
  </blockquote>
  
  <p>I don't understand why I m getting the 302 status code which is for URL redirection.</p>
  
  <p>I m trying to use this post to add data to my database.</p>
  
  <p>What should I do to make my Server accept this request? </p>