Generic response builder for expecting response messages on client.
@return
348505
public SoapClientResponseActionBuilder receive() {
        SoapClientResponseActionBuilder soapClientResponseActionBuilder;
        if (soapClient != null) {
            soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClient);
        } else {
            soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClientUri);
        }

        soapClientResponseActionBuilder.withApplicationContext(applicationContext);

        return soapClientResponseActionBuilder;
    }
909244
public static <T> GenericResponseBuilder<T> seeOther(URI location) {
    return GenericResponses.<T>status(Response.Status.SEE_OTHER).location(location);
  }
294351
@RequestMapping(path = "", method = RequestMethod.POST)
    public ResponseEntity<Customer> createCustomer(@RequestBody Customer customer){
        Customer newCustomer = customerService.createCustomer(customer);
        if(newCustomer != null){
            return new ResponseEntity<Customer>(newCustomer, HttpStatus.CREATED);
        }else{
            return new ResponseEntity<Customer>(HttpStatus.CONFLICT);
        }
    }
77323
final protected HttpResponseMessageImpl getResponseImpl() {
        if (null == getMyResponse()) {
            if (getObjectFactory() == null) {
                return null;
            }
            setMyResponse(getObjectFactory().getResponse(this));
        }
        return getMyResponse();
    }
1226105
public static Response getStatusResponse(Response.Status status, String... messages) {
		if (status == null) {
			return Response.status(Response.Status.BAD_REQUEST).build();
		}
		String msg = StringUtils.join(messages, ". ");
		if (StringUtils.isBlank(msg)) {
			msg = status.getReasonPhrase();
		}
		try {
			return GenericExceptionMapper.getExceptionResponse(status.getStatusCode(), msg);
		} catch (Exception ex) {
			logger.error(null, ex);
			return Response.status(Response.Status.BAD_REQUEST).build();
		}
	}
1251614
public HttpHeaders generatePreflightResponseHeaders() {
        final HttpHeaders headers = new DefaultHttpHeaders();
        preflightResponseHeaders.forEach((key, value) -> {
            final Object val = getValue(value);
            if (val instanceof Iterable) {
                headers.addObject(key, (Iterable<?>) val);
            } else {
                headers.addObject(key, val);
            }
        });
        return headers.asImmutable();
    }
803378
public static ServletResponse getContextResponse()
    {
        ServiceContext context = (ServiceContext) _localContext.get();

        if (context != null)
            return context._response;
        else
            return null;
    }
773121
@Override
	public Response process(Response.ResponseBuilder responseBuilder)
	{
		final String entity = process();

		responseBuilder.entity(entity);

		return responseBuilder.build();
	}
1006277
private void createResponse() {
        response = new GenericAnalyticsResponse(
            null,
            queryRowObservable.onBackpressureBuffer(),
            null,
            null,
            null,
            null,
            currentRequest,
            null,
            null,
            null
        );
    }
301631
public <T> HttpClientRequest.Builder<T> get(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.GET, uri, httpHandler);
    }
878138
final private HttpResponseMessageImpl getResponseImpl() {
        if (null == getMyResponse()) {
            setMyResponse(getObjectFactory().getResponse(this));
            // use limits from the request (not config)
            getMyResponse().setLimitOfTokenSize(getMyRequest().getLimitOfTokenSize());
            getMyResponse().setLimitOnNumberOfHeaders(getMyRequest().getLimitOnNumberOfHeaders());
        }
        return getMyResponse();
    }
1041287
protected AbstractMessageContentBuilder getMessageContentBuilder() {
        if (getAction().getMessageBuilder() != null && getAction().getMessageBuilder() instanceof AbstractMessageContentBuilder) {
            return (AbstractMessageContentBuilder) getAction().getMessageBuilder();
        } else {
            PayloadTemplateMessageBuilder messageBuilder = new PayloadTemplateMessageBuilder();
            getAction().setMessageBuilder(messageBuilder);
            return messageBuilder;
        }
    }
115827
public static OkHttpClient.Builder defaultOkHttpClientBuilder() {
        return new OkHttpClient.Builder()
            .connectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            .readTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            .writeTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            // enables certificate pinning
            .sslSocketFactory(SSLConfig.getSSLSocketFactory(), SSLConfig.getTrustManager());
    }
916689
protected String build(Response response) {
    StringBuilder sb = new StringBuilder();
    sb.append("<div class='container'>");
    sb.append("<div class='row-fluid'>");
    sb.append("<div class='span12'>");
    sb.append(buildJSONResponseBox(response));
    if( response._status == Response.Status.done ) response.toJava(sb);
    sb.append(buildResponseHeader(response));
    Builder builder = response.getBuilderFor(ROOT_OBJECT);
    if (builder == null) {
      sb.append("<h3>"+name()+"</h3>");
      builder = OBJECT_BUILDER;
    }
    for( String h : response.getHeaders() ) sb.append(h);
    if( response._response==null ) {
      boolean done = response._req.toHTML(sb);
      if(!done) {
        JsonParser parser = new JsonParser();
        String json = new String(response._req.writeJSON(new AutoBuffer()).buf());
        JsonObject o = (JsonObject) parser.parse(json);
        sb.append(builder.build(response, o, ""));
      }
    } else sb.append(builder.build(response,response._response,""));
    sb.append("</div></div></div>");
    return sb.toString();
  }
65461
private List<ResponseMessage> getResponseMessageList
    (List<SwaggerProperties.GlobalResponseMessageBody> globalResponseMessageBodyList) {
        List<ResponseMessage> responseMessages = new ArrayList<>();
        for (SwaggerProperties.GlobalResponseMessageBody globalResponseMessageBody : globalResponseMessageBodyList) {
            ResponseMessageBuilder responseMessageBuilder = new ResponseMessageBuilder();
            responseMessageBuilder.code(globalResponseMessageBody.getCode()).message(globalResponseMessageBody.getMessage());

            if (!StringUtils.isEmpty(globalResponseMessageBody.getModelRef())) {
                responseMessageBuilder.responseModel(new ModelRef(globalResponseMessageBody.getModelRef()));
            }
            responseMessages.add(responseMessageBuilder.build());
        }

        return responseMessages;
    }
324768
private String clientResponseToString(ClientResponse response) {
        if (response == null) {
            return null;
        }
        StringBuilder builder = new StringBuilder();
        builder.append("[status: ").append(response.getStatus());
        builder.append(", media type: ").append(response.getType());
        if (response.getStatus() != 404) {
            try {
                String responseBody = response.getEntity(String.class);
                if (responseBody != null) {
                    builder.append(", response body: ").append(responseBody);
                }
            } catch (RuntimeException ignore) {
                // Ignore if there is no response body, or IO error - it may have already been read in certain scenario.
            }
        }
        builder.append(", response headers: ").append(response.getHeaders());
        builder.append("]");
        return builder.toString();
    }
522007
public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();
        } else {
            try {
                return (Client) Thread.currentThread().getContextClassLoader().loadClass(clientClassName).newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }