Java Code Examples for org.apache.velocity.exception.MethodInvocationException#getMessage()

The following examples show how to use org.apache.velocity.exception.MethodInvocationException#getMessage() . 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: VelocityView.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Merge the template with the context.
 * Can be overridden to customize the behavior.
 * @param template the template to merge
 * @param context the Velocity context to use for rendering
 * @param response servlet response (use this to get the OutputStream or Writer)
 * @throws Exception if thrown by Velocity
 * @see org.apache.velocity.Template#merge
 */
protected void mergeTemplate(
		Template template, Context context, HttpServletResponse response) throws Exception {

	try {
		template.merge(context, response.getWriter());
	}
	catch (MethodInvocationException ex) {
		Throwable cause = ex.getWrappedThrowable();
		throw new NestedServletException(
				"Method invocation failed during rendering of Velocity view with name '" +
				getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName() +
				"], method '" + ex.getMethodName() + "'",
				cause==null ? ex : cause);
	}
}
 
Example 2
Source File: VelocityView.java    From scoold with Apache License 2.0 6 votes vote down vote up
/**
 * Merge the template with the context. Can be overridden to customize the behavior.
 *
 * @param template the template to merge
 * @param context the Velocity context to use for rendering
 * @param response servlet response (use this to get the OutputStream or Writer)
 * @throws Exception if thrown by Velocity
 * @see org.apache.velocity.Template#merge
 */
protected void mergeTemplate(
		Template template, Context context, HttpServletResponse response) throws Exception {

	try {
		response.setCharacterEncoding(Config.DEFAULT_ENCODING);
		template.merge(context, response.getWriter());
	} catch (MethodInvocationException ex) {
		Throwable cause = ex.getCause();
		throw new NestedServletException(
				"Method invocation failed during rendering of Velocity view with name '"
				+ getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName()
				+ "], method '" + ex.getMethodName() + "'",
				cause == null ? ex : cause);
	}
}
 
Example 3
Source File: VelocityView.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Merge the template with the context.
 * Can be overridden to customize the behavior.
 * @param template the template to merge
 * @param context the Velocity context to use for rendering
 * @param response servlet response (use this to get the OutputStream or Writer)
 * @throws Exception if thrown by Velocity
 * @see org.apache.velocity.Template#merge
 */
protected void mergeTemplate(
		Template template, Context context, HttpServletResponse response) throws Exception {

	try {
		template.merge(context, response.getWriter());
	}
	catch (MethodInvocationException ex) {
		Throwable cause = ex.getWrappedThrowable();
		throw new NestedServletException(
				"Method invocation failed during rendering of Velocity view with name '" +
				getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName() +
				"], method '" + ex.getMethodName() + "'",
				cause==null ? ex : cause);
	}
}