Java Code Examples for org.springframework.mock.web.MockHttpServletResponse#getCharacterEncoding()

The following examples show how to use org.springframework.mock.web.MockHttpServletResponse#getCharacterEncoding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrintingResultHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Print the response.
 */
protected void printResponse(MockHttpServletResponse response) throws Exception {
	String body = (response.getCharacterEncoding() != null ?
			response.getContentAsString() : MISSING_CHARACTER_ENCODING);

	this.printer.printValue("Status", response.getStatus());
	this.printer.printValue("Error message", response.getErrorMessage());
	this.printer.printValue("Headers", getResponseHeaders(response));
	this.printer.printValue("Content type", response.getContentType());
	this.printer.printValue("Body", body);
	this.printer.printValue("Forwarded URL", response.getForwardedUrl());
	this.printer.printValue("Redirected URL", response.getRedirectedUrl());
	printCookies(response.getCookies());
}
 
Example 2
Source File: PrintingResultHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Print the response.
 */
protected void printResponse(MockHttpServletResponse response) throws Exception {
	String body = (response.getCharacterEncoding() != null ?
			response.getContentAsString() : MISSING_CHARACTER_ENCODING);

	this.printer.printValue("Status", response.getStatus());
	this.printer.printValue("Error message", response.getErrorMessage());
	this.printer.printValue("Headers", getResponseHeaders(response));
	this.printer.printValue("Content type", response.getContentType());
	this.printer.printValue("Body", body);
	this.printer.printValue("Forwarded URL", response.getForwardedUrl());
	this.printer.printValue("Redirected URL", response.getRedirectedUrl());
	printCookies(response.getCookies());
}
 
Example 3
Source File: XpathResultMatchers.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Get the response encoding if explicitly defined in the response, {code null} otherwise.
 */
@Nullable
private String getDefinedEncoding(MockHttpServletResponse response) {
	return (response.isCharset() ? response.getCharacterEncoding() : null);
}
 
Example 4
Source File: XpathResultMatchers.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Get the response encoding if explicitly defined in the response, {code null} otherwise.
 */
@Nullable
private String getDefinedEncoding(MockHttpServletResponse response) {
	return (response.isCharset() ? response.getCharacterEncoding() : null);
}
 
Example 5
Source File: XpathResultMatchers.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Get the response encoding if explicitly defined in the response, {code null} otherwise.
 */
private String getDefinedEncoding(MockHttpServletResponse response) {
	return response.isCharset() ? response.getCharacterEncoding() : null;
}