Examples of Transport


Examples of org.codehaus.xfire.transport.Transport

        binding.setUndefinedEndpointAllowed(false);
       
        Element root = new Element("root", "a", "urn:a");
        root.addContent("hello");

        Transport transport = getTransportManager()
                .getTransport(SoapHttpTransport.SOAP11_HTTP_BINDING);

        Client client = new Client(transport, service, "http://localhost:8391/Echo");

        OperationInfo op = service.getServiceInfo().getOperation("echo");
View Full Code Here

Examples of org.codehaus.xfire.transport.Transport

        throws Exception
    {
        Element root = new Element("root", "a", "urn:a");
        root.addContent("hello");

        Transport transport = getTransportManager()
                .getTransport(SoapHttpTransport.SOAP11_HTTP_BINDING);

        Client client = new Client(transport, asyncService, "http://localhost:8391/AsyncService");
        Object[] response = client.invoke("echo", new Object[] { root });
View Full Code Here

Examples of org.codehaus.xfire.transport.Transport

public class SoapTransportTest
    extends AbstractXFireTest
{
    public void testHandler() throws Exception
    {
        Transport t = SoapTransportHelper.createSoapTransport(new HttpTransport());
       
        assertEquals(5, t.getInHandlers().size());
        assertEquals(2, t.getOutHandlers().size());
        assertEquals(1, t.getFaultHandlers().size());
    }
View Full Code Here

Examples of org.codehaus.xfire.transport.Transport

    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/BadEcho",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        Transport transport = getXFire().getTransportManager().getTransport(SoapHttpTransport.SOAP11_HTTP_BINDING);
        assertNotNull(transport.getFaultHandlers());

        expectErrorCode(req, 500, "Response code 500 required for faults.");
    }
View Full Code Here

Examples of org.codehaus.xfire.transport.Transport

    }
   
    public void testInvoke()
        throws Exception
    {
        Transport t = getXFire().getTransportManager().getTransport(LocalTransport.BINDING_ID);
        Channel channel = t.createChannel("xfire.local://FaultReceiver");
        JDOMEndpoint endpoint = new JDOMEndpoint();
        channel.setEndpoint(endpoint);
       
        Document response = invokeService((String)null, "/org/codehaus/xfire/addressing/FaultTo.xml");
        assertNull(response);
View Full Code Here

Examples of org.codehaus.xfire.transport.Transport

    }
   
    public void testInvoke()
        throws Exception
    {
        Transport t = getXFire().getTransportManager().getTransport(LocalTransport.BINDING_ID);
        Channel channel = t.createChannel("xfire.local://EchoReceiver");
        JDOMEndpoint endpoint = new JDOMEndpoint();
        channel.setEndpoint(endpoint);
       
        Document response = invokeService((String)null, "/org/codehaus/xfire/addressing/ReplyTo.xml");
View Full Code Here

Examples of org.cometd.server.Transport

    /* ------------------------------------------------------------ */
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // Look for an existing client and protect from context restarts
        Object clientObj = request.getAttribute(CLIENT_ATTR);
        Transport transport = null;
        int received = -1;
        boolean metaConnectDeliveryOnly = false;
        boolean pendingResponse = false;
        boolean metaConnect = false;
        final boolean initial;

        // Have we seen this request before
        AtmosphereBayeuxClient client = (clientObj instanceof ClientImpl) ? (AtmosphereBayeuxClient) clientObj : null;
        if (client != null) {
            initial = false;
            // yes - extract saved properties
            transport = (Transport) request.getAttribute(TRANSPORT_ATTR);
            transport.setResponse(response);
            metaConnectDeliveryOnly = client.isMetaConnectDeliveryOnly() || transport.isMetaConnectDeliveryOnly();
            metaConnect = true;
        } else {
            initial = true;
            Message[] messages = getMessages(request);
            received = messages.length;

            /* check jsonp parameter */
            String jsonpParam = request.getParameter("jsonp");

            // Handle all received messages
            try {
                for (Message message : messages) {
                    if (jsonpParam != null)
                        message.put("jsonp", jsonpParam);

                    if (client == null) {
                        String clientId = (String) message.get(AbstractBayeux.CLIENT_FIELD);
                        client = (AtmosphereBayeuxClient) _bayeux.getClient(clientId);

                        // If no client, SHOULD be a handshake, so force a
                        // transport and handle
                        if (client == null) {
                            // Setup a browser ID
                            String browser_id = findBrowserId(request);
                            if (browser_id == null)
                                browser_id = setBrowserId(request, response);

                            if (transport == null) {
                                transport = _bayeux.newTransport(client, message);
                                transport.setResponse(response);
                                metaConnectDeliveryOnly = transport.isMetaConnectDeliveryOnly();
                            }
                            _bayeux.handle(null, transport, message);
                            message = null;
                            continue;
                        }
                    }

                    String browser_id = findBrowserId(request);
                    if (browser_id != null && (client.getBrowserId() == null || !client.getBrowserId().equals(browser_id)))
                        client.setBrowserId(browser_id);

                    // resolve transport
                    if (transport == null) {
                        transport = _bayeux.newTransport(client, message);
                        transport.setResponse(response);
                        metaConnectDeliveryOnly = client.isMetaConnectDeliveryOnly() || transport.isMetaConnectDeliveryOnly();
                    }

                    // Tell client to hold messages as a response is likely to
                    // be sent.
                    if (!metaConnectDeliveryOnly && !pendingResponse) {
                        pendingResponse = true;
                        client.responsePending();
                    }

                    if (Bayeux.META_CONNECT.equals(message.getChannel()))
                        metaConnect = true;

                    _bayeux.handle(client, transport, message);
                }
            }
            finally {
                for (Message message : messages)
                    ((MessageImpl) message).decRef();
                if (pendingResponse) {
                    client.responded();
                }
            }
        }

        Message metaConnectReply = null;

        // Do we need to wait for messages
        if (transport != null) {
            metaConnectReply = transport.getMetaConnectReply();
            if (metaConnectReply != null) {
                long timeout = client.getTimeout();
                if (timeout == 0)
                    timeout = _bayeux.getTimeout();

                //Continuation continuation=ContinuationSupport.getContinuation(request);
                AtmosphereResource<HttpServletRequest, HttpServletResponse> continuation
                        = (AtmosphereResource) request.getAttribute(
                        AtmosphereServlet.ATMOSPHERE_RESOURCE);

                // Get messages or wait
                synchronized (client) {
                    if (!client.hasNonLazyMessages() && initial && received <= 1) {
                        // save state and suspend
                        request.setAttribute(CLIENT_ATTR, client);
                        request.setAttribute(TRANSPORT_ATTR, transport);
                        continuation.suspend(timeout, false);
                        client.setContinuation(continuation);
                        return;
                    }
                }

                client.setContinuation(null);
                transport.setMetaConnectReply(null);
            } else if (client != null) {
                client.access();
            }
        }

        if (client != null) {
            if (metaConnectDeliveryOnly && !metaConnect) {
                // wake up any long poll
                client.resume();
            } else {
                List<Message> messages;
                synchronized (client) {
                    client.doDeliverListeners();

                    ArrayQueue<Message> clientMessages = (ArrayQueue<Message>) client.getQueue();
                    // Copy the messages to avoid synchronization
                    messages = new ArrayList<Message>(clientMessages);
                    // Empty client's queue
                    clientMessages.clear();
                }

                final int size = messages.size();
                for (int i = 0; i < size; i++) {
                    final Message message = messages.get(i);
                    final MessageImpl mesgImpl = (message instanceof MessageImpl) ? (MessageImpl) message : null;

                    // Can we short cut the message?
                    if (i == 0 && size == 1 && mesgImpl != null && _refsThreshold > 0 && metaConnectReply != null && transport instanceof JSONTransport) {
                        // is there a response already prepared
                        ByteBuffer buffer = mesgImpl.getBuffer();
                        if (buffer != null) {
                            // Send pre-prepared buffer
                            request.setAttribute("org.mortbay.jetty.ResponseBuffer", buffer);
                            if (metaConnectReply instanceof MessageImpl)
                                ((MessageImpl) metaConnectReply).decRef();
                            metaConnectReply = null;
                            transport = null;
                            mesgImpl.decRef();
                            continue;
                        } else if (mesgImpl.getRefs() >= _refsThreshold) {
                            // create multi-use buffer
                            byte[] contentBytes = ("[" + mesgImpl.getJSON() + ",{\"" + Bayeux.SUCCESSFUL_FIELD + "\":true,\"" + Bayeux.CHANNEL_FIELD
                                    + "\":\"" + Bayeux.META_CONNECT + "\"}]").getBytes(StringUtil.__UTF8);
                            int contentLength = contentBytes.length;

                            String headerString = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/json; charset=utf-8\r\n" + "Content-Length: "
                                    + contentLength + "\r\n" + "\r\n";

                            byte[] headerBytes = headerString.getBytes(StringUtil.__UTF8);

                            buffer = ByteBuffer.allocateDirect(headerBytes.length + contentLength);
                            buffer.put(headerBytes);
                            buffer.put(contentBytes);
                            buffer.flip();

                            mesgImpl.setBuffer(buffer);
                            request.setAttribute("org.mortbay.jetty.ResponseBuffer", buffer);
                            metaConnectReply = null;
                            if (metaConnectReply instanceof MessageImpl)
                                ((MessageImpl) metaConnectReply).decRef();
                            transport = null;
                            mesgImpl.decRef();
                            continue;
                        }
                    }

                    if (message != null)
                        transport.send(message);
                    if (mesgImpl != null)
                        mesgImpl.decRef();
                }

                if (metaConnectReply != null) {
                    metaConnectReply = _bayeux.extendSendMeta(client, metaConnectReply);
                    transport.send(metaConnectReply);
                    if (metaConnectReply instanceof MessageImpl)
                        ((MessageImpl) metaConnectReply).decRef();
                }
            }
        }

        if (transport != null)
            transport.complete();
    }
View Full Code Here

Examples of org.coweb.bots.transport.Transport

   */
  @SuppressWarnings("unchecked")
  public Transport getServiceBroker(String serviceName) {

    log.fine("ServiceHandler::getServiceBroker for " + serviceName);
    Transport broker = this.brokers.get(serviceName);
    if (broker != null)
      return broker;

    log.fine(this.cowebConfig.get("bots").toString());
    Object[] botConfigs = (Object[]) this.cowebConfig.get("bots");
    if (botConfigs == null) {
      return null;
    }

    Map<String, Object> botConfig = null;
    for (int i = 0; i < botConfigs.length; i++) {
      Map<String, Object> tmp = (Map<String, Object>) botConfigs[i];
      String s = (String) tmp.get("service");

      if (s.equals(serviceName)) {
        botConfig = tmp;
        break;
      }
    }

    if (botConfig == null)
      return null;

    String brokerStr = (String) botConfig.get("broker");
    if (brokerStr == null) {
      if (botConfig.get("class") != null)
        brokerStr = "org.coweb.bots.transport.LocalTransport";
      else
        return null;
    }

    try {
      Class<? extends Transport> clazz = Class.forName(brokerStr)
          .asSubclass(Transport.class);
      broker = clazz.newInstance();
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }

    broker.setBotConfig(botConfig);
    broker.setSessionId(this.sessionId);
    this.brokers.put(serviceName, broker);
    return broker;
  }
View Full Code Here

Examples of org.dru.clay.respository.transport.Transport

    // URI base = new URI("file:///home/erikb/dev/source/ivy-cache/");
    // Transport transport = new FileSystemTransport(FileSystemOptions.CreateDirectories);

    URI base = new URI("http://ivy.dev.midasplayer.com/repository/");
    Transport transport = new HttpTransport();
    Repository repository = new IvyRepository(base, ivyPattern, artifactPattern);

    CacheIvyRepository cacheIvyRepository = new CacheIvyRepository(new File("repo"), repository, transport);

    Group group = new Group("king");
View Full Code Here

Examples of org.eclipse.jgit.transport.Transport

   */
  public Collection<Ref> call() throws GitAPIException,
      JGitInternalException {
    checkCallable();

    Transport transport = null;
    FetchConnection fc = null;
    try {
      transport = Transport.open(repo, remote);
      transport.setOptionUploadPack(uploadPack);
      configure(transport);
      Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1);
      if (tags)
        refSpecs.add(new RefSpec(
            "refs/tags/*:refs/remotes/origin/tags/*"));
      if (heads)
        refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*"));
      Collection<Ref> refs;
      Map<String, Ref> refmap = new HashMap<String, Ref>();
      fc = transport.openFetch();
      refs = fc.getRefs();
      if (refSpecs.isEmpty())
        for (Ref r : refs)
          refmap.put(r.getName(), r);
      else
        for (Ref r : refs)
          for (RefSpec rs : refSpecs)
            if (rs.matchSource(r)) {
              refmap.put(r.getName(), r);
              break;
            }
      return refmap.values();
    } catch (URISyntaxException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote));
    } catch (NotSupportedException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    } catch (TransportException e) {
        throw new org.eclipse.jgit.api.errors.TransportException(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    } finally {
      if (fc != null)
        fc.close();
      if (transport != null)
        transport.close();
    }
  }
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.