Produces an HttpRequest entity that is not suitable for asynchronous HTTP requests. Once
an entity is harvested, it must be wholly consumed before more rows can be added to this
decoder (i.e. with synchronous requests)
339583
@Override
    public AbstractHttpEntity harvest(long generation) {
        ByteBufferEntity enty;
        try {
            m_writers.get(generation).flush();
            enty = new ByteBufferEntity(m_bbos.get(generation).toByteBuffer(), CSVContentType);
        } catch (IOException e) {
            throw new BulkException("unable to flush CSVWriter", e);
        } finally {
            m_bbos.get(generation).reset();
        }
        return enty;
    }
914008
def serialize(self, value, entity, request):
        

        self._validate_existence(value)
        self._run_validators(value)

        if not value:
            return value

        return self.factory.serialize(value, request)
977533
private <T> CompletionStage<T> executeRequest(HttpAsyncClient httpClient,
            HttpUriRequest httpRequest, JsonParser<T> parser) {
        CompletableFuture<T> future = new CompletableFuture<>();
        httpClient.execute(httpRequest, new FutureCallback<HttpResponse>() {
            @Override
            public void failed(Exception e) {
                future.completeExceptionally(e);
            }

            @Override
            public void completed(HttpResponse response) {
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode == HttpStatus.SC_OK ||
                        statusCode == HttpStatus.SC_ACCEPTED) {

                    // Parse result type from the returned JSON
                    try {
                        T result = parser.parse(response.getEntity().getContent());
                        future.complete(result);
                    } catch (Exception e) {
                        future.completeExceptionally(e);
                    }
                } else {
                    future.completeExceptionally(createSaltException(statusCode));
                }
            }

            @Override
            public void cancelled() {
                future.cancel(false);
            }
        });

        return future;
    }
648937
function onEntityRetrieved( serverResponse ) {
			if( !serverResponse.data[ configuration.entityName ] ) {
				throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
			}

			var rawEntity = serverResponse.data[ configuration.entityName ];

			// Put the raw entity into our raw entity cache.
			// We keep the raw copy to allow caching of the raw data.
			self.__cacheMaintain( self.__entityCacheRaw[ configuration.collectionName || configuration.entityName ],
				rawEntity,
				"update",
				false );

			// Deserialize the object and place it into the cache.
			// We do not need to check here if the object already exists in the cache.
			// While it could be possible that the same entity is retrieved multiple times, __updateCacheWithEntity
			// will not insert duplicates into the cache.
			var deserialized = self.deserializer( rawEntity );
			self.__updateCacheWithEntity( deserialized );
			return deserialized;
		}
318154
public <E> QueryResponse<E> executeEntityQueryRequest(Class<E> expectedResultType,
      EntityQueryRequest request) {
    try {
      GqlQuery.Builder<Entity> queryBuilder = Query.newGqlQueryBuilder(ResultType.ENTITY,
          request.getQuery());
      queryBuilder.setNamespace(entityManager.getEffectiveNamespace());
      queryBuilder.setAllowLiteral(request.isAllowLiterals());
      QueryUtils.applyNamedBindings(queryBuilder, request.getNamedBindings());
      QueryUtils.applyPositionalBindings(queryBuilder, request.getPositionalBindings());
      GqlQuery<Entity> gqlQuery = queryBuilder.build();
      QueryResults<Entity> results = nativeReader.run(gqlQuery);
      List<E> entities = new ArrayList<>();
      DefaultQueryResponse<E> response = new DefaultQueryResponse<>();
      response.setStartCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      while (results.hasNext()) {
        Entity result = results.next();
        E entity = Unmarshaller.unmarshal(result, expectedResultType);
        entities.add(entity);
      }
      response.setResults(entities);
      response.setEndCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      response.setQueryResponseMetadata(
          new DefaultQueryResponseMetadata(
              QueryResponseMetadata.QueryState.forMoreResultsType(results.getMoreResults())));
      entityManager.executeEntityListeners(CallbackType.POST_LOAD, entities);
      return response;
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }
755389
public static HttpEntity newStringEntity(String s) {
        try {
            return new StringEntity(s);
        } catch (UnsupportedEncodingException e) {
            throw new SdkClientException("Unable to create HTTP entity: " + e.getMessage(), e);
        }
    }
1345377
public synchronized AsynchConsumerProxyQueue createReadAheadProxyQueue(Reliability unrecoverableReliability) // f187521.2.1
      throws SIResourceException, SIIncorrectCallException
	{
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createReadAheadProxyQueue");
      checkClosed();
      
      // begin D249096
      short id = nextId();
      AsynchConsumerProxyQueue proxyQueue = 
         new ReadAheadSessionProxyQueueImpl(this, id, conversation, unrecoverableReliability);   // f187521.2.1 // f191114
      // end D249096
      
      idToProxyQueueMap.put(new ImmutableId(id), proxyQueue);
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createReadAheadProxyQueue", proxyQueue);
      return proxyQueue;      
	}
318612
@RequestMapping(path = "", method = RequestMethod.POST)
    public ResponseEntity<Order> createOrder(@RequestBody OrderInfo orderInfo) {
        Order order = orderService.createOrder(orderInfo);
        if(order != null){
            return new ResponseEntity<Order>(order, HttpStatus.CREATED);
        }
        return new ResponseEntity<Order>(HttpStatus.BAD_REQUEST);
    }
1060949
private ResponseEntity<?> handleRequestInternal(HttpMethod method, HttpEntity<?> requestEntity) {
        HttpMessage request = endpointConfiguration.getMessageConverter().convertInbound(requestEntity, endpointConfiguration, null);

        HttpServletRequest servletRequest = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        UrlPathHelper pathHelper = new UrlPathHelper();

        Enumeration allHeaders = servletRequest.getHeaderNames();
        for (String headerName : CollectionUtils.toArray(allHeaders, new String[] {})) {
            if (request.getHeader(headerName) == null) {
                String headerValue = servletRequest.getHeader(headerName);
                request.header(headerName, headerValue != null ? headerValue : "");
            }
        }

        if (endpointConfiguration.isHandleCookies()) {
            request.setCookies(servletRequest.getCookies());
        }

        if (endpointConfiguration.isHandleAttributeHeaders()) {
            Enumeration<String> attributeNames = servletRequest.getAttributeNames();
            while (attributeNames.hasMoreElements()) {
                String attributeName = attributeNames.nextElement();
                Object attribute = servletRequest.getAttribute(attributeName);
                request.setHeader(attributeName, attribute);
            }
        }

        request.path(pathHelper.getRequestUri(servletRequest))
                .uri(pathHelper.getRequestUri(servletRequest))
                .contextPath(pathHelper.getContextPath(servletRequest))
                .queryParams(Optional.ofNullable(pathHelper.getOriginatingQueryString(servletRequest))
                                    .map(queryString -> queryString.replaceAll("&", ","))
                                    .orElse(""))
                .version(servletRequest.getProtocol())
                .method(method);

        Message response = endpointAdapter.handleMessage(request);

        ResponseEntity<?> responseEntity;
        if (response == null) {
            responseEntity = new ResponseEntity<>(HttpStatus.valueOf(endpointConfiguration.getDefaultStatusCode()));
        } else {
            HttpMessage httpResponse;
            if (response instanceof HttpMessage) {
                httpResponse = (HttpMessage) response;
            } else {
                httpResponse = new HttpMessage(response);
            }

            if (httpResponse.getStatusCode() == null) {
                httpResponse.status(HttpStatus.valueOf(endpointConfiguration.getDefaultStatusCode()));
            }

            responseEntity = (ResponseEntity<?>) endpointConfiguration.getMessageConverter().convertOutbound(httpResponse, endpointConfiguration, null);

            if (endpointConfiguration.isHandleCookies() && httpResponse.getCookies() != null) {
                HttpServletResponse servletResponse = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
                for (Cookie cookie : httpResponse.getCookies()) {
                    servletResponse.addCookie(cookie);
                }
            }
        }
        responseCache.add(responseEntity);
        
        return responseEntity;
    }
1119372
@Override
    public Future<M> requestData() {
        logger.debug(this + " requestData...");
        try {
            validateInitialization();
            synchronized (syncMonitor) {

                // Check if sync is in process.
                if (syncFuture != null && !syncFuture.isDone()) {

                    // Recover sync task if it was canceled for instance during remote reinitialization.
                    if (syncTask == null || syncTask.isDone()) {
                        syncTask = sync();
                    }
                    return syncFuture;
                } else {
                    // cleanup old sync task
                    if (syncTask != null && !syncTask.isDone()) {
                        syncTask.cancel(true);
                    }
                }

                // Create new sync process
                syncFuture = new CompletableFutureLite();
                syncTask = sync();
                return syncFuture;
            }
        } catch (CouldNotPerformException ex) {
            return FutureProcessor.canceledFuture(new CouldNotPerformException("Could not request data!", ex));
        }
    }
1002908
function httpToFloraRequest(httpRequest) {
    return new Promise((resolve, reject) => {
        const parsedUrl = url.parse(httpRequest.url, true);
        const matches = parsedUrl.pathname.match(/^\/(.+)\/([^/.]*)(?:\.([a-z]+))?$/);
        if (!matches) {
            resolve(null);
            return;
        }

        /*
         * Gather GET parameters.
         */
        const opts = {
            resource: matches[1],
            _status: httpRequest.flora.status,
            _httpRequest: httpRequest
        };

        if (matches[2]) opts.id = matches[2];
        if (matches[3]) opts.format = matches[3];

        Object.keys(parsedUrl.query).forEach(key => {
            if (!Object.prototype.hasOwnProperty.call(opts, key)) {
                if (Array.isArray(parsedUrl.query[key])) {
                    reject(new RequestError(`Duplicate parameter "${key}" in URL`));
                    return;
                }

                opts[key] = parsedUrl.query[key];
            }
        });

        /*
         * Handle POST payload.
         */
        httpRequest.on('error', err => reject(new RequestError('Error reading HTTP-Request: ' + err.message)));

        if (httpRequest.method === 'POST' && !Number.isNaN(Number(httpRequest.headers['content-length']))) {
            let payload = '';
            let contentTypes;

            if (httpRequest.headers['content-type']) {
                contentTypes = contentType.parse(httpRequest.headers['content-type']);
            } else {
                reject(new RequestError('Missing required Content-Type headers'));
                return;
            }

            if (contentTypes.type === 'application/json' || contentTypes.type === 'application/x-www-form-urlencoded') {
                // POST Form Data or JSON
                httpRequest.setEncoding(contentTypes.parameters.charset || 'utf-8');
                httpRequest.on('data', chunk => {
                    payload += chunk;
                });

                httpRequest.on('end', () => {
                    if (contentTypes.type === 'application/x-www-form-urlencoded') {
                        payload = querystring.parse(payload);
                        Object.keys(payload).forEach(key => {
                            if (!Object.prototype.hasOwnProperty.call(opts, key)) {
                                if (Array.isArray(payload[key])) {
                                    reject(new RequestError(`Duplicate parameter "${key}" in Payload`));
                                    return;
                                }

                                opts[key] = payload[key];
                            }
                        });
                    } else if (contentTypes.type === 'application/json') {
                        try {
                            opts.data = JSON.parse(payload);
                        } catch (err) {
                            reject(new RequestError('Invalid payload, must be valid JSON'));
                            return;
                        }
                    }

                    resolve(new Request(opts));
                });
            } else {
                // multipart file upload or other content types (e.g. single file upload)
                const busboy = new Busboy({ headers: httpRequest.headers });
                busboy.on('error', err => reject(err));
                opts.data = busboy;
                resolve(new Request(opts));
                setImmediate(() => httpRequest.pipe(busboy));
            }
        } else {
            resolve(new Request(opts));
        }
    });
}
177903
protected String executeRequest(HttpRequestBase request) throws IOException {
        HttpResponse response = client.execute(request);
        HttpEntity entity = response.getEntity();
        if (response.getStatusLine().getStatusCode() == 200) {
            return EntityUtils.toString(entity, "utf-8");
        } else {
            EntityUtils.consumeQuietly(entity);
            throw new IOException(response.getStatusLine().toString());
        }
    }
1173175
public synchronized AsynchConsumerProxyQueue createOrderedProxyQueue(OrderingContext context)
      throws SIResourceException, SIIncorrectCallException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createOrderedProxyQueue", context);
      
      short id = nextId();
         
      AsynchConsumerProxyQueue proxyQueue = createOrderedProxyQueue(context, id, (short) 0); // D249096
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createOrderedProxyQueue", proxyQueue);
      return proxyQueue;
   }
643231
def ProcessAllReadyRequests(self):
    
    request_dict = data_store.REL_DB.ReadFlowRequestsReadyForProcessing(
        self.rdf_flow.client_id,
        self.rdf_flow.flow_id,
        next_needed_request=self.rdf_flow.next_request_to_process)
    if not request_dict:
      return 0

    processed = 0
    while self.rdf_flow.next_request_to_process in request_dict:
      request, responses = request_dict[self.rdf_flow.next_request_to_process]
      self.RunStateMethod(request.next_state, request, responses)
      self.rdf_flow.next_request_to_process += 1
      processed += 1
      self.completed_requests.append(request)

    if processed and self.IsRunning() and not self.outstanding_requests:
      self.RunStateMethod("End")
      if (self.rdf_flow.flow_state == self.rdf_flow.FlowState.RUNNING and
          not self.outstanding_requests):
        self.MarkDone()

    self.PersistState()

    if not self.IsRunning():
      # All requests and responses can now be deleted.
      self._ClearAllRequestsAndResponses()

    return processed
792624
def get_entity(resource_name, name, namespace = nil, options = {})
      ns_prefix = build_namespace_prefix(namespace)
      response = handle_exception do
        rest_client[ns_prefix + resource_name + "/#{name}"]
          .get(@headers)
      end
      format_response(options[:as] || @as, response.body)
    end
761090
def add(self, entity):
		
		result = self._http_req('connections', method='POST', payload=entity)
		status = result['status']
		if not status==201:
			raise ServiceRegistryError(status,"Couldn't add entity")

		self.debug(0x01,result)
		return result['decoded']
50289
@SuppressWarnings("unchecked")
    public static <T> T unwrap(final T entity) {
        if (isProxy(entity)) {
            return (T) asProxy(entity).__unwrap();
        }
        return entity;
    }