Package org.springframework.http.server

Examples of org.springframework.http.server.ServletServerHttpResponse


    Assert.isInstanceOf(HttpHeaders.class, returnValue);
    HttpHeaders headers = (HttpHeaders) returnValue;

    if (!headers.isEmpty()) {
      HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class);
      ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(servletResponse);
      outputMessage.getHeaders().putAll(headers);
      outputMessage.getBody(); // flush headers
    }
  }
View Full Code Here


   * @param servletResponse current HTTP response
   * @return the HttpInputMessage instance to use
   * @throws Exception in case of errors
   */
  protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletResponse) throws Exception {
    return new ServletServerHttpResponse(servletResponse);
  }
View Full Code Here

    List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
    if (acceptedMediaTypes.isEmpty()) {
      acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
    }
    MediaType.sortByQualityValue(acceptedMediaTypes);
    HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());
    Class<?> returnValueType = returnValue.getClass();
    if (this.messageConverters != null) {
      for (MediaType acceptedMediaType : acceptedMediaTypes) {
        for (HttpMessageConverter messageConverter : this.messageConverters) {
          if (messageConverter.canWrite(returnValueType, acceptedMediaType)) {
View Full Code Here

    this.body = "body";
    this.contentType = MediaType.TEXT_PLAIN;
    this.converterType = StringHttpMessageConverter.class;
    this.returnType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle"), -1);
    this.request = new ServletServerHttpRequest(new MockHttpServletRequest());
    this.response = new ServletServerHttpResponse(new MockHttpServletResponse());
  }
View Full Code Here

  public void setUp() {
    ConversionService conversionService = new DefaultConversionService();
    this.converter = new ObjectToStringHttpMessageConverter(conversionService);

    this.servletResponse = new MockHttpServletResponse();
    this.response = new ServletServerHttpResponse(this.servletResponse);
  }
View Full Code Here

      List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
      if (acceptedMediaTypes.isEmpty()) {
        acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
      }
      MediaType.sortBySpecificity(acceptedMediaTypes);
      HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());
      Class<?> returnValueType = returnValue.getClass();
      List<MediaType> allSupportedMediaTypes = new ArrayList<MediaType>();
      if (messageConverters != null) {
        for (HttpMessageConverter messageConverter : messageConverters) {
          allSupportedMediaTypes.addAll(messageConverter.getSupportedMediaTypes());
View Full Code Here

   * @param servletResponse current HTTP response
   * @return the HttpInputMessage instance to use
   * @throws Exception in case of errors
   */
    protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletResponse) throws Exception {
    return new ServletServerHttpResponse(servletResponse);
  }
View Full Code Here

    List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
    if (acceptedMediaTypes.isEmpty()) {
      acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
    }
    MediaType.sortByQualityValue(acceptedMediaTypes);
    HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());
    Class<?> returnValueType = returnValue.getClass();
    if (messageConverters != null) {
      for (MediaType acceptedMediaType : acceptedMediaTypes) {
        for (HttpMessageConverter messageConverter : messageConverters) {
          if (messageConverter.canWrite(returnValueType, acceptedMediaType)) {
View Full Code Here

      throws IOException {
    MediaType contentType = contentType(request);
    HttpMessageConverter converter =
        messageConverter(contentType, error, request);
    response.setStatus(responseStatus.value());
    HttpOutputMessage output = new ServletServerHttpResponse(response);
    converter.write(error, contentType, output);
  }
View Full Code Here

            acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
        }

        MediaType.sortByQualityValue(acceptedMediaTypes);

        HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());

        Class<?> bodyType = body.getClass();

        List<HttpMessageConverter<?>> converters = this.allMessageConverters;
View Full Code Here

TOP

Related Classes of org.springframework.http.server.ServletServerHttpResponse

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.