src/main/java/org/robotframework/remoteserver/servlet/ServerMethods.java
public Map<String, Object> run_keyword(String keyword, Object[] args, Map<String, Object> kwargs) {
        Map<String, Object> result = new HashMap<String, Object>();
        StdStreamRedirecter redirector = new StdStreamRedirecter();
        redirector.redirectStdStreams();
        try {
            result.put("status", "PASS");
            Object retObj = "";
            if (keyword.equalsIgnoreCase("stop_remote_server")) {
                retObj = stopRemoteServer();
            } else {
                try {
                    retObj = servlet.getLibrary().runKeyword(keyword, args, kwargs);
                } catch (Exception e) {
                    if (illegalArgumentIn(e)) {
                        for (int i = 0; i < args.length; i++)
                            args[i] = arraysToLists(args[i]);
                        retObj = servlet.getLibrary().runKeyword(keyword, args, kwargs);
                    } else {
                        throw (e);
                    }
                }
            }
            if (retObj != null && !retObj.equals("")) {
                result.put("return", retObj);
            }
        } catch (Throwable e) {
            result.put("status", "FAIL");
            Throwable thrown = e.getCause() == null ? e : e.getCause();
            result.put("error", getError(thrown));
            result.put("traceback", ExceptionUtils.getStackTrace(thrown));
            boolean continuable = isFlagSet("ROBOT_CONTINUE_ON_FAILURE", thrown);
            if (continuable) {
                result.put("continuable", true);
            }
            boolean fatal = isFlagSet("ROBOT_EXIT_ON_FAILURE", thrown);
            if (fatal) {
                result.put("fatal", true);
            }
        } finally {
            String stdOut = StringUtils.defaultString(redirector.getStdOutAsString());
            String stdErr = StringUtils.defaultString(redirector.getStdErrAsString());
            if (!stdOut.isEmpty() || !stdErr.isEmpty()) {
                StringBuilder output = new StringBuilder(stdOut);
                if (!stdOut.isEmpty() && !stdErr.isEmpty()) {
                    if (!stdOut.endsWith("\n")) {
                        output.append("\n");
                    }
                    boolean addLevel = true;
                    for (String prefix : logLevelPrefixes) {
                        if (stdErr.startsWith(prefix)) {
                            addLevel = false;
                            break;
                        }
                    }
                    if (addLevel) {
                        output.append("*INFO*");
                    }
                }
                result.put("output", output.append(stdErr).toString());
            }
            redirector.resetStdStreams();
        }
        return result;
    }
public Map<String, Object> run_keyword(String keyword, Object[] args, Map<String, Object> kwargs) {
        Map<String, Object> result = new HashMap<String, Object>();
        StdStreamRedirecter redirector = new StdStreamRedirecter();
        redirector.redirectStdStreams();
        try {
            result.put("status", "PASS");
            Object retObj = "";
            if (keyword.equalsIgnoreCase("stop_remote_server")) {
                retObj = stopRemoteServer();
            } else {
                try {
                    retObj = servlet.getLibrary().runKeyword(keyword, args, kwargs);
                } catch (Exception e) {
                    if (illegalArgumentIn(e)) {
                        for (int i = 0; i < args.length; i++)
                            args[i] = arraysToLists(args[i]);
                        retObj = servlet.getLibrary().runKeyword(keyword, args, kwargs);
                    } else {
                        throw (e);
                    }
                }
            }
            if (retObj != null && !retObj.equals("")) {
                result.put("return", retObj);
            }
        } catch (Throwable e) {
            result.put("status", "FAIL");
            Throwable thrown = e.getCause() == null ? e : e.getCause();
            result.put("error", getError(thrown));
            result.put("traceback", ExceptionUtils.getStackTrace(thrown));
            boolean continuable = isFlagSet("ROBOT_CONTINUE_ON_FAILURE", thrown);
            if (continuable) {
                result.put("continuable", true);
            }
            boolean fatal = isFlagSet("ROBOT_EXIT_ON_FAILURE", thrown);
            if (fatal) {
                result.put("fatal", true);
            }
        } finally {
            String stdOut = StringUtils.defaultString(redirector.getStdOutAsString());
            String stdErr = StringUtils.defaultString(redirector.getStdErrAsString());
            if (!stdOut.isEmpty() || !stdErr.isEmpty()) {
                StringBuilder output = new StringBuilder(stdOut);
                if (!stdOut.isEmpty() && !stdErr.isEmpty()) {
                    if (!stdOut.endsWith("\n")) {
                        output.append("\n");
                    }
                    boolean addLevel = true;
                    for (String prefix : logLevelPrefixes) {
                        if (stdErr.startsWith(prefix)) {
                            addLevel = false;
                            break;
                        }
                    }
                    if (addLevel) {
                        output.append("*INFO*");
                    }
                }
                result.put("output", output.append(stdErr).toString());
            }
            redirector.resetStdStreams();
        }
        return result;
    }
public Map < String , Object > run_keyword ( String keyword , Object [ ] args , Map < String , Object > kwargs ) { Map < String , Object > result = new HashMap < String , Object > ( ) ; StdStreamRedirecter redirector = new StdStreamRedirecter ( ) ; redirector . redirectStdStreams ( ) ; try { result . put ( "status" , "PASS" ) ; Object retObj = "" ; if ( keyword . equalsIgnoreCase ( "stop_remote_server" ) ) { retObj = stopRemoteServer ( ) ; } else { try { retObj = servlet . getLibrary ( ) . runKeyword ( keyword , args , kwargs ) ; } catch ( Exception e ) { if ( illegalArgumentIn ( e ) ) { for ( int i = 0 ; i < args . length ; i ++ ) args [ i ] = arraysToLists ( args [ i ] ) ; retObj = servlet . getLibrary ( ) . runKeyword ( keyword , args , kwargs ) ; } else { throw ( e ) ; } } } if ( retObj != null && ! retObj . equals ( "" ) ) { result . put ( "return" , retObj ) ; } } catch ( Throwable e ) { result . put ( "status" , "FAIL" ) ; Throwable thrown = e . getCause ( ) == null ? e : e . getCause ( ) ; result . put ( "error" , getError ( thrown ) ) ; result . put ( "traceback" , ExceptionUtils . getStackTrace ( thrown ) ) ; boolean continuable = isFlagSet ( "ROBOT_CONTINUE_ON_FAILURE" , thrown ) ; if ( continuable ) { result . put ( "continuable" , true ) ; } boolean fatal = isFlagSet ( "ROBOT_EXIT_ON_FAILURE" , thrown ) ; if ( fatal ) { result . put ( "fatal" , true ) ; } } finally { String stdOut = StringUtils . defaultString ( redirector . getStdOutAsString ( ) ) ; String stdErr = StringUtils . defaultString ( redirector . getStdErrAsString ( ) ) ; if ( ! stdOut . isEmpty ( ) || ! stdErr . isEmpty ( ) ) { StringBuilder output = new StringBuilder ( stdOut ) ; if ( ! stdOut . isEmpty ( ) && ! stdErr . isEmpty ( ) ) { if ( ! stdOut . endsWith ( "\n" ) ) { output . append ( "\n" ) ; } boolean addLevel = true ; for ( String prefix : logLevelPrefixes ) { if ( stdErr . startsWith ( prefix ) ) { addLevel = false ; break ; } } if ( addLevel ) { output . append ( "*INFO*" ) ; } } result . put ( "output" , output . append ( stdErr ) . toString ( ) ) ; } redirector . resetStdStreams ( ) ; } return result ; }
Run the given keyword and return the results.

@param keyword
keyword to run
@param args
arguments packed in an array to pass to the keyword method
@param kwargs
keyword arguments to pass to the keyword method
@return remote result Map containing the execution results
Run the given keyword and return the results .