Package org.jboss.resteasy.client

Examples of org.jboss.resteasy.client.ClientRequest.header()


      }

      // we test that the preferred can be handled
      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.header(HttpHeaders.ACCEPT, "text/plain;q=0.5, text/html");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here


    for (Entry<String, List<Object>> h : request.headers().entrySet()) {
      StringBuilder sb = new StringBuilder();
      for (Object v : h.getValue()) {
        sb.append(String.valueOf(v));
      }
      client.header(h.getKey(), sb);
    }

    if (request.entity() != null) {
      client.body(request.entity().getContentType(), request.entity().getEntity());
    }
View Full Code Here

         HornetQRestLogger.LOGGER.debug("Created request " + request);

         for (XmlHttpHeader header : registration.getHeaders())
         {
            HornetQRestLogger.LOGGER.debug("Setting XmlHttpHeader: " + header.getName() + "=" + header.getValue());
            request.header(header.getName(), header.getValue());
         }
         HttpMessageHelper.buildMessage(message, request, contentType);
         ClientResponse<?> res = null;
         try
         {
View Full Code Here

      initialized = true;
      initAuthentication();
      ClientRequest request = executor.createRequest(registration.getTarget().getHref());
      for (XmlHttpHeader header : registration.getHeaders())
      {
         request.header(header.getName(), header.getValue());
      }
     ClientResponse<?> res = request.head();
      if (res.getStatus() != 200)
      {
         throw new RuntimeException("Failed to query HornetQ REST destination for init information.  Status: " + res.getStatus());
View Full Code Here

         ClientRequest request = executor.createRequest(uri);
         request.followRedirects(false);

         for (XmlHttpHeader header : registration.getHeaders())
         {
            request.header(header.getName(), header.getValue());
         }
         HttpMessageHelper.buildMessage(message, request, contentType);
         ClientResponse res = null;
         try
         {
View Full Code Here

      initialized = true;
      initAuthentication();
      ClientRequest request = executor.createRequest(registration.getTarget().getHref());
      for (XmlHttpHeader header : registration.getHeaders())
      {
         request.header(header.getName(), header.getValue());
      }
      ClientResponse<?> res = request.head();
      if (res.getStatus() != 200)
      {
         throw new RuntimeException("Failed to query HornetQ REST destination for init information.  Status: " + res.getStatus());
View Full Code Here

      try
      {
         if (uri == null) throw new RuntimeException("You have not set a base URI for the client proxy");

         ClientRequest request = new ClientRequest(uri, executor, providerFactory);
         if (accepts != null) request.header(HttpHeaders.ACCEPT, accepts.toString());
         this.copyClientInterceptorsTo(request);

         boolean isClientResponseResult = ClientResponse.class.isAssignableFrom(method.getReturnType());
         request.followRedirects(!isClientResponseResult || this.followRedirects);
View Full Code Here

      try
      {
         if (uri == null) throw new RuntimeException("You have not set a base URI for the client proxy");

         ClientRequest request = new ClientRequest(uri, executor, providerFactory);
         if (accepts != null) request.header(HttpHeaders.ACCEPT, accepts.toString());
         this.copyClientInterceptorsTo(request);

         boolean isClientResponseResult = ClientResponse.class.isAssignableFrom(method.getReturnType());
         request.followRedirects(!isClientResponseResult || this.followRedirects);
View Full Code Here

        ClientRequest req = new ClientRequest(DEVGARDEN_SMS_GW + "/" + mode + "/sms");

        String body = "number=" + tel + "&" + "message=" + message; // TODO encode?
        req.body(MediaType.APPLICATION_FORM_URLENCODED, body);

        req.header("Authorization","TAuth realm=\"https://odg.t-online.de\",tauth_token=\"" + token + "\"");
        req.accept(MediaType.TEXT_PLAIN_TYPE);



        try {
View Full Code Here

        if (_subResourcePath != null) {
            uriBuilder = UriBuilder.fromUri(String.format(_subResourcePath, args));
        }
        ClientRequest request = new ClientRequest(uriBuilder, _executor, _providerFactory);
        if (_accepts != null) {
            request.header(HttpHeaders.ACCEPT, _accepts.toString());
        }
        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
            String name = entry.getKey();
            List<String> values = entry.getValue();
            for (String value : values) {
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.