private String post()

in src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java [317:347]


    private String post(String url, Pair<String, Object>... ps) throws NCClientException, IOException {
        if (!started)
            throw new IllegalStateException("Client is not initialized.");
        
        List<Pair<String, ?>> psList =
            Arrays.stream(ps).filter(p -> p != null && p.getRight() != null).collect(Collectors.toList());
    
        try {
            return postPlain(url, psList);
        }
        catch (NCClientException e) {
            if (!AUTH_ERR.equals(e.getServerCode()))
                throw e;
            
            try {
                log.debug("Reconnect attempt because token is invalid.");
    
                acsTok = restSignin();
    
                log.debug("Reconnected OK.");
    
                // Replaces token.
                return postPlain(url, psList.stream().
                    map(p -> p.getLeft().equals("acsTok") ? Pair.of("acsTok", acsTok) : p).
                    collect(Collectors.toList()));
            }
            catch (NCClientException e1) {
                throw e;
            }
        }
    }