Examples of HttpMessageNotWritableException


Examples of org.springframework.http.converter.HttpMessageNotWritableException

    try {
      Result result = new StreamResult(outputMessage.getBody());
      transform(t, result);
    }
    catch (TransformerException ex) {
      throw new HttpMessageNotWritableException("Could not transform [" + t + "] to output message", ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

      Marshaller marshaller = createMarshaller(clazz);
      setCharset(headers.getContentType(), marshaller);
      marshaller.marshal(o, result);
    }
    catch (MarshalException ex) {
      throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

    Assert.notNull(this.marshaller, "Property 'marshaller' is required");
    try {
      this.marshaller.marshal(o, result);
    }
    catch (MarshallingFailureException ex) {
      throw new HttpMessageNotWritableException("Could not write [" + o + "]", ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

      }
      this.gson.toJson(o, writer);
      writer.close();
    }
    catch (JsonIOException ex) {
      throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

    testException(ex);
  }

  @Test
  public void httpMessageNotWritable() {
    Exception ex = new HttpMessageNotWritableException("");
    testException(ex);
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

    }

    @Override
    public void handleReturnValue(Object returnValue, MethodParameter returnType,
        ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
      throw new HttpMessageNotWritableException("oops, can't write");
    }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

    assertEquals("Invalid status code", 400, response.getStatus());
  }

  @Test
  public void handleHttpMessageNotWritable() {
    HttpMessageNotWritableException ex = new HttpMessageNotWritableException("foo");
    ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
    assertNotNull("No ModelAndView returned", mav);
    assertTrue("No Empty ModelAndView returned", mav.isEmpty());
    assertEquals("Invalid status code", 500, response.getStatus());
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

  protected void writeToResult(T t, HttpHeaders headers, Result result) throws IOException {
    try {
      transform(t, result);
    }
    catch (TransformerException ex) {
      throw new HttpMessageNotWritableException("Could not transform [" + t + "] to [" + result + "]", ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

      Marshaller marshaller = createMarshaller(clazz);
      setCharset(headers.getContentType(), marshaller);
      marshaller.marshal(o, result);
    }
    catch (MarshalException ex) {
      throw new HttpMessageNotWritableException("Could not marshal [" + o + "]: " + ex.getMessage(), ex);
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of org.springframework.http.converter.HttpMessageNotWritableException

    Assert.notNull(this.marshaller, "Property 'marshaller' is required");
    try {
      this.marshaller.marshal(o, result);
    }
    catch (MarshallingFailureException ex) {
      throw new HttpMessageNotWritableException("Could not write [" + o + "]", ex);
    }
  }
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.