Search in sources :

Example 1 with ErrorCommand

use of com.hazelcast.internal.ascii.memcache.ErrorCommand in project hazelcast by hazelcast.

the class HttpDeleteCommandParser method parser.

@Override
public TextCommand parser(TextReadHandler readHandler, String cmd, int space) {
    StringTokenizer st = new StringTokenizer(cmd);
    st.nextToken();
    String uri;
    if (st.hasMoreTokens()) {
        uri = st.nextToken();
    } else {
        return new ErrorCommand(ERROR_CLIENT);
    }
    return new HttpDeleteCommand(uri);
}
Also used : StringTokenizer(java.util.StringTokenizer) ErrorCommand(com.hazelcast.internal.ascii.memcache.ErrorCommand)

Example 2 with ErrorCommand

use of com.hazelcast.internal.ascii.memcache.ErrorCommand in project hazelcast by hazelcast.

the class HttpGetCommandParser method parser.

@Override
public TextCommand parser(TextReadHandler readHandler, String cmd, int space) {
    StringTokenizer st = new StringTokenizer(cmd);
    st.nextToken();
    String uri;
    if (st.hasMoreTokens()) {
        uri = st.nextToken();
    } else {
        return new ErrorCommand(ERROR_CLIENT);
    }
    return new HttpGetCommand(uri);
}
Also used : StringTokenizer(java.util.StringTokenizer) ErrorCommand(com.hazelcast.internal.ascii.memcache.ErrorCommand)

Example 3 with ErrorCommand

use of com.hazelcast.internal.ascii.memcache.ErrorCommand in project hazelcast by hazelcast.

the class TextReadHandler method processCmd.

private void processCmd(String cmd) {
    try {
        int space = cmd.indexOf(' ');
        String operation = (space == -1) ? cmd : cmd.substring(0, space);
        CommandParser commandParser = MAP_COMMAND_PARSERS.get(operation);
        if (commandParser != null) {
            command = commandParser.parser(this, cmd, space);
        } else {
            command = new ErrorCommand(UNKNOWN);
        }
    } catch (Throwable t) {
        logger.finest(t);
        command = new ErrorCommand(ERROR_CLIENT, "Invalid command : " + cmd);
    }
}
Also used : ErrorCommand(com.hazelcast.internal.ascii.memcache.ErrorCommand) HttpDeleteCommandParser(com.hazelcast.internal.ascii.rest.HttpDeleteCommandParser) HttpPostCommandParser(com.hazelcast.internal.ascii.rest.HttpPostCommandParser) TouchCommandParser(com.hazelcast.internal.ascii.memcache.TouchCommandParser) HttpGetCommandParser(com.hazelcast.internal.ascii.rest.HttpGetCommandParser) SetCommandParser(com.hazelcast.internal.ascii.memcache.SetCommandParser) GetCommandParser(com.hazelcast.internal.ascii.memcache.GetCommandParser) IncrementCommandParser(com.hazelcast.internal.ascii.memcache.IncrementCommandParser) CommandParser(com.hazelcast.internal.ascii.CommandParser) DeleteCommandParser(com.hazelcast.internal.ascii.memcache.DeleteCommandParser) SimpleCommandParser(com.hazelcast.internal.ascii.memcache.SimpleCommandParser)

Example 4 with ErrorCommand

use of com.hazelcast.internal.ascii.memcache.ErrorCommand in project hazelcast by hazelcast.

the class HttpPostCommandParser method parser.

@Override
public TextCommand parser(TextReadHandler readHandler, String cmd, int space) {
    StringTokenizer st = new StringTokenizer(cmd);
    st.nextToken();
    String uri;
    if (st.hasMoreTokens()) {
        uri = st.nextToken();
    } else {
        return new ErrorCommand(ERROR_CLIENT);
    }
    return new HttpPostCommand(readHandler, uri);
}
Also used : StringTokenizer(java.util.StringTokenizer) ErrorCommand(com.hazelcast.internal.ascii.memcache.ErrorCommand)

Aggregations

ErrorCommand (com.hazelcast.internal.ascii.memcache.ErrorCommand)4 StringTokenizer (java.util.StringTokenizer)3 CommandParser (com.hazelcast.internal.ascii.CommandParser)1 DeleteCommandParser (com.hazelcast.internal.ascii.memcache.DeleteCommandParser)1 GetCommandParser (com.hazelcast.internal.ascii.memcache.GetCommandParser)1 IncrementCommandParser (com.hazelcast.internal.ascii.memcache.IncrementCommandParser)1 SetCommandParser (com.hazelcast.internal.ascii.memcache.SetCommandParser)1 SimpleCommandParser (com.hazelcast.internal.ascii.memcache.SimpleCommandParser)1 TouchCommandParser (com.hazelcast.internal.ascii.memcache.TouchCommandParser)1 HttpDeleteCommandParser (com.hazelcast.internal.ascii.rest.HttpDeleteCommandParser)1 HttpGetCommandParser (com.hazelcast.internal.ascii.rest.HttpGetCommandParser)1 HttpPostCommandParser (com.hazelcast.internal.ascii.rest.HttpPostCommandParser)1