Package com.dotcms.repackage.com.sun.jersey.api.client

Examples of com.dotcms.repackage.com.sun.jersey.api.client.WebResource


                form.field("ENDPOINT_ID", endpoint.getId());
                form.bodyPart(new FileDataBodyPart("bundle", bundle, MediaType.MULTIPART_FORM_DATA_TYPE));


                //Sending bundle to endpoint
                WebResource resource = client.resource(endpoint.toURL()+"/api/bundlePublisher/publish");

                ClientResponse response =
                    resource.type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class, form);


                if(response.getClientResponseStatus().getStatusCode() == HttpStatus.SC_OK)
                {
                  detail.setStatus(PublishAuditStatus.Status.BUNDLE_SENT_SUCCESSFULLY.getCode());
View Full Code Here


    if(Config.getStringProperty("TRUSTSTORE_PATH") != null && !Config.getStringProperty("TRUSTSTORE_PATH").trim().equals("")) {
        clientConfig.getProperties()
        .put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(tFactory.getHostnameVerifier(), tFactory.getSSLContext()));
    }
        Client client = Client.create(clientConfig);
        WebResource webResource;

        List<PublishAuditStatus> pendingAudits = pubAuditAPI.getPendingPublishAuditStatus();

        //Foreach Bundle
        for(PublishAuditStatus pendingAudit: pendingAudits) {
          //Gets groups list
          PublishAuditHistory localHistory = pendingAudit.getStatusPojo();

          Map<String, Map<String, EndpointDetail>> endpointsMap = localHistory.getEndpointsMap();
          Map<String, EndpointDetail> endpointsGroup = null;

          Map<String, Map<String, EndpointDetail>> bufferMap = new HashMap<String, Map<String, EndpointDetail>>();
          //Foreach Group
          for(String group : endpointsMap.keySet()) {
            endpointsGroup = endpointsMap.get(group);

            //Foreach endpoint
            for(String endpointId: endpointsGroup.keySet()) {
              EndpointDetail localDetail = endpointsGroup.get(endpointId);

              if(localDetail.getStatus() != PublishAuditStatus.Status.SUCCESS.getCode() &&
                localDetail.getStatus() != PublishAuditStatus.Status.FAILED_TO_PUBLISH.getCode()) {

                PublishingEndPoint target = endpointAPI.findEndPointById(endpointId);

                if(target != null && !target.isSending()) {
                  webResource = client.resource(target.toURL()+"/api/auditPublishing");

                  try {
                    PublishAuditHistory remoteHistory =
                        PublishAuditHistory.getObjectFromString(
                        webResource
                        .path("get")
                        .path(pendingAudit.getBundleId()).get(String.class));

                    if(remoteHistory != null) {
                      bufferMap.putAll(remoteHistory.getEndpointsMap());
View Full Code Here

    form.field( "BUNDLE_NAME", bundle.getName() );
    form.field( "ENDPOINT_ID", receivingFromEndpoint.getId() );
    form.bodyPart( new FileDataBodyPart( "bundle", newBundleFile, MediaType.MULTIPART_FORM_DATA_TYPE ) );

    //Sending bundle to endpoint
    WebResource resource = client.resource( receivingFromEndpoint.toURL() + "/api/bundlePublisher/publish" );
    ClientResponse clientResponse = resource.type( MediaType.MULTIPART_FORM_DATA ).post( ClientResponse.class, form );
    //Validations
    assertEquals( clientResponse.getClientResponseStatus().getStatusCode(), HttpStatus.SC_OK );

    //Get current status dates
    status = PublishAuditAPI.getInstance().getPublishAuditStatus( newBundleId );//Get the audit records related to this new bundle
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.com.sun.jersey.api.client.WebResource

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.