Examples of ErrorResponseMessage


Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

            if (!specificMessage.metaGetKillSession()) {
                final String username = specificMessage.Username;
                final String password = specificMessage.Password;
                if (!authenticate(username, password)) {
                    // there is no session to this message...that's a problem
                    final ErrorResponseMessage errorMessage = new ErrorResponseMessage();
                    errorMessage.setSessionAsUUID(RexProMessage.EMPTY_SESSION);
                    errorMessage.Request = specificMessage.Request;
                    errorMessage.ErrorMessage = "Invalid username or password.";
                    errorMessage.metaSetFlag(ErrorResponseMessage.AUTH_FAILURE_ERROR);

                    request.writeResponseMessage(errorMessage);
                    ctx.write(request);

                    return ctx.getStopAction();
                }
            }
        } else if (message instanceof ScriptRequestMessage && !message.hasSession()) {
      // sessionless script requests don't support secure requests atm - requires a changes to the
      // rexpro protocol to do so
      // there is no session to this message...that's a problem
      final ErrorResponseMessage errorMessage = new ErrorResponseMessage();
      errorMessage.setSessionAsUUID(RexProMessage.EMPTY_SESSION);
      errorMessage.Request = message.Request;
      errorMessage.ErrorMessage = "Cannot make sessionless requests with <security> turned on.";
      errorMessage.metaSetFlag(ErrorResponseMessage.AUTH_FAILURE_ERROR);

      request.writeResponseMessage(errorMessage);
      ctx.write(request);

      return ctx.getStopAction();
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

public class ErrorResponseMessageTemplate extends RexProMessageTemplate<ErrorResponseMessage> {

    @Override
    protected ErrorResponseMessage instantiateMessage() {
        return new ErrorResponseMessage();
    }
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

    protected int messageArraySize() {
        return super.messageArraySize() + 1;
    }

    protected ErrorResponseMessage instantiateMessage() {
        return new ErrorResponseMessage();
    }
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

        super.writeMessageArray(pk, msg);
        pk.write(msg.ErrorMessage);
    }

    protected ErrorResponseMessage readMessageArray(final Unpacker un, final ErrorResponseMessage msg) throws IOException {
        ErrorResponseMessage message = super.readMessageArray(un, msg);
        message.ErrorMessage = un.trySkipNil()?null:un.readString();
        return message;
    }
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

            return ctx.getInvokeAction(remainder);
        } catch (Exception ex) {
            logger.error(String.format("Error during message deserialization of a message of type [%s].", messageType), ex);

            final ErrorResponseMessage deserializationMessage = MessageUtil.createErrorResponse(
                    RexProMessage.EMPTY_REQUEST_AS_BYTES,
                    RexProMessage.EMPTY_SESSION_AS_BYTES,
                    ErrorResponseMessage.INVALID_MESSAGE_ERROR,
                    ex.toString());

            try {
                ctx.write(deserializationMessage);
            } catch (Exception inner) {
                logger.error(String.format(
                        "Could not write error message back to client for request [%s] session [%s].  Should have reported flag [%s] message [%s] to client",
                        deserializationMessage.requestAsUUID(),
                        deserializationMessage.sessionAsUUID(),
                        deserializationMessage.metaGetFlag(),
                        deserializationMessage.ErrorMessage));
            }

            return ctx.getStopAction();
        }
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

        } catch (Exception ex) {
            // if there's an error during serialization with msgpack this could tank.  the script will already
            // have executed and likely committed with success.  just means the response won't get back cleanly
            // to the client.
            final ByteArrayOutputStream rpms = new ByteArrayOutputStream();
            ErrorResponseMessage errorMsg = MessageUtil.createErrorResponse(msg.Request, msg.Session,
                    ErrorResponseMessage.RESULT_SERIALIZATION_ERROR,
                    MessageTokens.ERROR_RESULT_SERIALIZATION);
            rexProMessageAsBytes = rpms.toByteArray();

            ctx.setMessage(null);
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.msg.ErrorResponseMessage

        } catch (Exception ex) {
            // if there's an error during serialization with msgpack this could tank.  the script will already
            // have executed and likely committed with success.  just means the response won't get back cleanly
            // to the client.
            ErrorResponseMessage errorMsg = MessageUtil.createErrorResponse(
                responseMessage.Request,
                responseMessage.Session,
                ErrorResponseMessage.RESULT_SERIALIZATION_ERROR,
                MessageTokens.ERROR_RESULT_SERIALIZATION
            );

            try {
                responseBytes = getSerializer().serialize(errorMsg, ErrorResponseMessage.class);
                responseMessage = errorMsg;
            } catch (IOException ex2) {
                logger.error(String.format(
                    "Could not serialize error message for request [%s] session [%s].  Should have reported flag [%s] message [%s] to client",
                    errorMsg.requestAsUUID(),
                    errorMsg.sessionAsUUID(),
                    errorMsg.metaGetFlag(),
                    errorMsg.ErrorMessage
                ));
            }

        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.