Package org.jboss.remoting

Examples of org.jboss.remoting.InvocationRequest


         case Version.VERSION_2:
         case Version.VERSION_2_2:
         {

            receivedInvocationRequest.set(FALSE);
            InvocationRequest invocationRequest = null;
            MessageBytes method = req.method();
            if (method.equals("GET") || method.equals("HEAD")
                  || (method.equals("OPTIONS") && req.getContentLength() <= 0))
            {
               invocationRequest = createNewInvocationRequest(request, response, null);
            } else
            {
               // must be POST or PUT
               UnMarshaller unmarshaller = getUnMarshaller();
               Object obj = unmarshaller.read(request.getInputStream(), request);
               if (obj instanceof InvocationRequest)
               {
                  receivedInvocationRequest.set(TRUE);
                  invocationRequest = (InvocationRequest) obj;
                  if (invocationRequest.getReturnPayload() == null)
                  {
                     // need to create a return payload map, so can be populated with metadata
                     invocationRequest.setReturnPayload(response);
                  }
                  Map requestPayloadMap = invocationRequest.getRequestPayload();
                  if (requestPayloadMap != null)
                  {
                     request.putAll(requestPayloadMap);
                  }
                  invocationRequest.setRequestPayload(request);
               } else
               {
                  invocationRequest = createNewInvocationRequest(request, response, obj);
               }
            }
View Full Code Here


   {
      // will try to use the same session id if possible to track
      String sessionId = getSessionId(requestMap);
      String subSystem = (String) requestMap.get(HEADER_SUBSYSTEM);

      InvocationRequest request = null;

      boolean isLeaseQueury = checkForLeaseQuery(requestMap);
      if(isLeaseQueury)
      {
         addLeaseInfo(responseMap);
         request = new InvocationRequest(sessionId, subSystem, "$PING$", null, responseMap, null);
      }
      else
      {
         request = new InvocationRequest(sessionId, subSystem, payload,
                                                        requestMap, responseMap, null);
      }
      return request;
   }
View Full Code Here

         MarshalledInvocation marshInv = new MarshalledInvocation(inv);
         marshInv.setTransactionPropagationContext(getTransactionPropagationContext());

         MockUnifiedInvokerHA invoker = ((MockInvokerLocator)getInvoker().getLocator()).getInvoker();
        
         return invoker.invoke(new InvocationRequest("", "", marshInv,
               metadata, null, null));
      }
View Full Code Here

    * (even if the class is declared Serializable) contain request and response payloads which are
    * not, so I am having trouble sending them over wire back to the client.
    */
   private static InvocationRequest dirtyCopy(InvocationRequest source)
   {
      return new InvocationRequest(source.getSessionId(),
                                   source.getSubsystem(),
                                   source.getParameter(),
                                   null,
                                   null,
                                   source.getLocator());
View Full Code Here

            {
               String userAgent = (String) userAgentObj;
               isRemotingUserAgent = userAgent.startsWith("JBossRemoting");
            }

            InvocationRequest invocationRequest = versionedRead(req, request, response, version);

            if (invocationRequest.getRequestPayload() == null)
               invocationRequest.setRequestPayload(new HashMap());
           
            MessageBytes remoteAddressMB = req.remoteAddr();
            if (remoteAddressMB != null)
            {
               String remoteAddressString = remoteAddressMB.toString();
               InetAddress remoteAddress = InetAddress.getByName(remoteAddressString);
               invocationRequest.getRequestPayload().put(Remoting.CLIENT_ADDRESS, remoteAddress)
            }
            else
            {
               log.debug("unable to retrieve client address from coyote transport layer");
            }
           
           
            // FIXME: OPTIONS method handling ?
            try
            {
               // call transport on the subclass, get the result to handback
               responseObject = invoke(invocationRequest);
            }
            catch(Throwable ex)
            {
               log.debug("Error thrown calling invoke on server invoker.", ex);
               responseObject = ex;
               isError = true;
            }

            //Start with response code of 204 (no content), then if is a return from handler, change to 200 (ok)
            int status;
            String message = "";

            if(responseObject != null)
            {
               if(isError)
               {
                  status = 500;
                  message = "JBoss Remoting: Error occurred within target application.";
               }
               else
               {
                  status = 200;
                  message = "OK";
               }
            }
            else
            {
               if (isRemotingUserAgent && !req.method().equals("HEAD"))
               {
                  status = 200;
                  message = "OK";
               }
               else
               {
                  status = 204;
                  message = "No Content";
               }
            }

            // extract response code/message if exists
            Map responseMap = invocationRequest.getReturnPayload();
            if(responseMap != null)
            {
               Integer handlerStatus = (Integer) responseMap.get(HTTPMetadataConstants.RESPONSE_CODE);
               if(handlerStatus != null)
               {
                  status = handlerStatus.intValue();
               }
               String handlerMessage = (String) responseMap.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
               if(handlerMessage != null)
               {
                  message = handlerMessage;
               }
            }
            res.setStatus(status);
            res.setMessage(message);

            if (isRemotingUserAgent && ((Boolean)receivedInvocationRequest.get()).booleanValue())
            {
               responseMap = ((ResponseMap) responseMap).getMap();
               responseObject = new InvocationResponse(invocationRequest.getSessionId(),
                                                       responseObject, isError, responseMap);
            }

            if(responseObject != null)
            {
View Full Code Here

            {
               request.put(HTTPUnMarshaller.PRESERVE_LINES, o);
            }

            receivedInvocationRequest.set(FALSE);
            InvocationRequest invocationRequest = null;
            MessageBytes method = req.method();
            if (method.equals("GET") || method.equals("HEAD")
                  || (method.equals("OPTIONS") && req.getContentLength() <= 0))
            {
               invocationRequest = createNewInvocationRequest(request, response, null);
            } else
            {
               // must be POST or PUT
               UnMarshaller unmarshaller = getUnMarshaller();
               Object obj = null;
               if (unmarshaller instanceof VersionedUnMarshaller)
                  obj = ((VersionedUnMarshaller)unmarshaller).read(request.getInputStream(), request, version);
               else
                  obj = unmarshaller.read(request.getInputStream(), request);
               if (obj instanceof InvocationRequest)
               {
                  receivedInvocationRequest.set(TRUE);
                  invocationRequest = (InvocationRequest) obj;
                  if (invocationRequest.getReturnPayload() == null)
                  {
                     // need to create a return payload map, so can be populated with metadata
                     invocationRequest.setReturnPayload(response);
                  }
                  Map requestPayloadMap = invocationRequest.getRequestPayload();
                  if (requestPayloadMap != null)
                  {
                     request.putAll(requestPayloadMap);
                  }
                  invocationRequest.setRequestPayload(request);
               } else
               {
                  invocationRequest = createNewInvocationRequest(request, response, obj);
               }
            }
View Full Code Here

   {
      // will try to use the same session id if possible to track
      String sessionId = getSessionId(requestMap);
      String subSystem = (String) requestMap.get(HEADER_SUBSYSTEM);

      InvocationRequest request = null;

      boolean isLeaseQueury = checkForLeaseQuery(requestMap);
      if(isLeaseQueury)
      {
         addLeaseInfo(responseMap);
         request = new InvocationRequest(sessionId, subSystem, "$PING$", null, responseMap, null);
      }
      else
      {
         request = new InvocationRequest(sessionId, subSystem, payload,
                                                        requestMap, responseMap, null);
      }
      return request;
   }
View Full Code Here

         try
         {
            home = (Home) it.next();
            addr = InetAddress.getByName(home.host);
            address = createServerAddress(addr, home.port);
            invoke(new InvocationRequest(null, null, ServerInvoker.ECHO, null, null, null));
            if (trace) log.trace(this + " able to contact server at: " + home);
            return home;
         }
         catch (Throwable e)
         {
View Full Code Here

      }

      boolean serverSideOneway = false;
      if (oneway && invocation instanceof InvocationRequest)
      {
         InvocationRequest ir = (InvocationRequest) invocation;
         if (ir.getParameter() instanceof OnewayInvocation)
            serverSideOneway = true;
      }
     
      int retryCount = 0;
      Exception sockEx = null;
View Full Code Here

         ServletInputStream inputStream = request.getInputStream();
         UnMarshaller unmarshaller = MarshalFactory.getUnMarshaller(HTTPUnMarshaller.DATATYPE, getSerializationType());
         Object obj = unmarshaller.read(inputStream, metadata);
         inputStream.close();

         InvocationRequest invocationRequest = null;

         if(obj instanceof InvocationRequest)
         {
            invocationRequest = (InvocationRequest) obj;
         }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.InvocationRequest

Copyright © 2018 www.massapicom. 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.