src/main/java/pityoulish/sockets/server/RequestHandlerImpl.java
protected ByteBuffer dispatch(MsgBoardRequest mbreq, InetAddress address)
    throws ProtocolException
   {
     boolean silent =
       (mbreq.getReqType() == MsgBoardRequest.ReqType.LIST_MESSAGES) &&
       (mbreq.getLimit() == Integer.valueOf(125));

     if (!silent)
        rhExpositor.describeRequest(mbreq, address);

     ByteBuffer result = null;
     switch (mbreq.getReqType())
      {
       case LIST_MESSAGES: {
         MsgBoardResponse<MessageBatch> response =
           mbrHandler.listMessages(mbreq, address);
         if (!silent)
            rhExpositor.describeMessageBatch(response);
         result = rspBuilder.buildMessageBatch(response);
       } break;

       case PUT_MESSAGE: {
         MsgBoardResponse<String> response =
           mbrHandler.putMessage(mbreq, address);
         rhExpositor.describeInfoResponse(response);
         result = rspBuilder.buildInfoResponse(response);
       } break;

       case OBTAIN_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.obtainTicket(mbreq, address);
         rhExpositor.describeTicketGrant(response);
         result = rspBuilder.buildTicketGrant(response);
       } break;

       case RETURN_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.returnTicket(mbreq, address);
         rhExpositor.describeInfoResponse(response);
         result = rspBuilder.buildInfoResponse(response);
       } break;

       case REPLACE_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.replaceTicket(mbreq, address);
         rhExpositor.describeTicketGrant(response);
         result = rspBuilder.buildTicketGrant(response);
       } break;

        //@@@ default case might be invoked after adding more request types
      }

     return result;
   }
/**
   * Dispatches a request to the {@link MsgBoardRequestHandler mbrHandler}.
   * Generates the response using the {@link ResponseBuilder rspBuilder}.
   *
   * @param mbreq       the request to process
   * @param address     the network address of the client
   *
   * @return a buffer containing the response data, backed by an array
   *
   * @throws ProtocolException  in case of a problem
   */
Dispatches a request to the  MsgBoardRequestHandler mbrHandler.
Generates the response using the  ResponseBuilder rspBuilder.

@param mbreq       the request to process
@param address     the network address of the client

@return a buffer containing the response data, backed by an array

@throws ProtocolException  in case of a problem
Dispatches a request to the MsgBoardRequestHandler mbrHandler . Generates the response using the ResponseBuilder rspBuilder . @param mbreq the request to process @param address the network address of the client @return a buffer containing the response data backed by an array @throws ProtocolException in case of a problem
protected ByteBuffer dispatch(MsgBoardRequest mbreq, InetAddress address)
    throws ProtocolException
   {
     boolean silent =
       (mbreq.getReqType() == MsgBoardRequest.ReqType.LIST_MESSAGES) &&
       (mbreq.getLimit() == Integer.valueOf(125));
     if (!silent)
        rhExpositor.describeRequest(mbreq, address);
     ByteBuffer result = null;
     switch (mbreq.getReqType())
      {
       case LIST_MESSAGES: {
         MsgBoardResponse<MessageBatch> response =
           mbrHandler.listMessages(mbreq, address);
         if (!silent)
            rhExpositor.describeMessageBatch(response);
         result = rspBuilder.buildMessageBatch(response);
       } break;
       case PUT_MESSAGE: {
         MsgBoardResponse<String> response =
           mbrHandler.putMessage(mbreq, address);
         rhExpositor.describeInfoResponse(response);
         result = rspBuilder.buildInfoResponse(response);
       } break;
       case OBTAIN_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.obtainTicket(mbreq, address);
         rhExpositor.describeTicketGrant(response);
         result = rspBuilder.buildTicketGrant(response);
       } break;
       case RETURN_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.returnTicket(mbreq, address);
         rhExpositor.describeInfoResponse(response);
         result = rspBuilder.buildInfoResponse(response);
       } break;
       case REPLACE_TICKET: {
         MsgBoardResponse<String> response =
           mbrHandler.replaceTicket(mbreq, address);
         rhExpositor.describeTicketGrant(response);
         result = rspBuilder.buildTicketGrant(response);
       } break;
      }
     return result;
   }
protected ByteBuffer dispatch ( MsgBoardRequest mbreq , InetAddress address ) throws ProtocolException { boolean silent = ( mbreq . getReqType ( ) == MsgBoardRequest . ReqType . LIST_MESSAGES ) && ( mbreq . getLimit ( ) == Integer . valueOf ( 125 ) ) ; if ( ! silent ) rhExpositor . describeRequest ( mbreq , address ) ; ByteBuffer result = null ; switch ( mbreq . getReqType ( ) ) { case LIST_MESSAGES : { MsgBoardResponse < MessageBatch > response = mbrHandler . listMessages ( mbreq , address ) ; if ( ! silent ) rhExpositor . describeMessageBatch ( response ) ; result = rspBuilder . buildMessageBatch ( response ) ; } break ; case PUT_MESSAGE : { MsgBoardResponse < String > response = mbrHandler . putMessage ( mbreq , address ) ; rhExpositor . describeInfoResponse ( response ) ; result = rspBuilder . buildInfoResponse ( response ) ; } break ; case OBTAIN_TICKET : { MsgBoardResponse < String > response = mbrHandler . obtainTicket ( mbreq , address ) ; rhExpositor . describeTicketGrant ( response ) ; result = rspBuilder . buildTicketGrant ( response ) ; } break ; case RETURN_TICKET : { MsgBoardResponse < String > response = mbrHandler . returnTicket ( mbreq , address ) ; rhExpositor . describeInfoResponse ( response ) ; result = rspBuilder . buildInfoResponse ( response ) ; } break ; case REPLACE_TICKET : { MsgBoardResponse < String > response = mbrHandler . replaceTicket ( mbreq , address ) ; rhExpositor . describeTicketGrant ( response ) ; result = rspBuilder . buildTicketGrant ( response ) ; } break ; } return result ; }
Dispatches a request to the {@link MsgBoardRequestHandler mbrHandler}.
Dispatches a request to the { @link MsgBoardRequestHandler mbrHandler } .
//@@@ default case might be invoked after adding more request types