Polishing

This commit is contained in:
Juergen Hoeller
2015-11-14 23:32:36 +01:00
parent 48838d48d2
commit 71fc2ba174
20 changed files with 182 additions and 185 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,4 +33,5 @@ public interface ArgumentAware {
* @param argument the result of the nested {@code spring:argument} tag
*/
void addArgument(Object argument) throws JspTagException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@ import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* JSP tag for collecting arguments and passing them to an {@link ArgumentAware} ancestor
* in the tag hierarchy.
* JSP tag for collecting arguments and passing them to an {@link ArgumentAware}
* ancestor in the tag hierarchy.
*
* <p>This tag must be nested under an argument aware tag.
*
@@ -37,7 +37,17 @@ public class ArgumentTag extends BodyTagSupport {
private boolean valueSet;
// tag lifecycle
/**
* Set the value of the argument (optional).
* <pIf not set, the tag's body content will get evaluated.
* @param value the parameter value
*/
public void setValue(Object value) {
this.value = value;
this.valueSet = true;
}
@Override
public int doEndTag() throws JspException {
@@ -46,38 +56,20 @@ public class ArgumentTag extends BodyTagSupport {
argument = this.value;
}
else if (getBodyContent() != null) {
// get the value from the tag body
// Get the value from the tag body
argument = getBodyContent().getString().trim();
}
// find a param aware ancestor
ArgumentAware argumentAwareTag = (ArgumentAware) findAncestorWithClass(this,
ArgumentAware.class);
// Find a param-aware ancestor
ArgumentAware argumentAwareTag = (ArgumentAware) findAncestorWithClass(this, ArgumentAware.class);
if (argumentAwareTag == null) {
throw new JspException(
"The argument tag must be a descendant of a tag that supports arguments");
throw new JspException("The argument tag must be a descendant of a tag that supports arguments");
}
argumentAwareTag.addArgument(argument);
return EVAL_PAGE;
}
// tag attribute mutators
/**
* Sets the value of the argument
*
* <p>
* Optional. If not set, the tag's body content is evaluated.
*
* @param value the parameter value
*/
public void setValue(Object value) {
this.value = value;
this.valueSet = true;
}
@Override
public void release() {
super.release();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,22 @@ public class ParamTag extends BodyTagSupport {
private boolean valueSet;
// tag lifecycle
/**
* Set the name of the parameter (required).
*/
public void setName(String name) {
this.name = name;
}
/**
* Set the value of the parameter (optional).
*/
public void setValue(String value) {
this.value = value;
this.valueSet = true;
}
@Override
public int doEndTag() throws JspException {
@@ -50,16 +65,14 @@ public class ParamTag extends BodyTagSupport {
param.setValue(this.value);
}
else if (getBodyContent() != null) {
// get the value from the tag body
// Get the value from the tag body
param.setValue(getBodyContent().getString().trim());
}
// find a param aware ancestor
ParamAware paramAwareTag = (ParamAware) findAncestorWithClass(this,
ParamAware.class);
// Find a param aware ancestor
ParamAware paramAwareTag = (ParamAware) findAncestorWithClass(this, ParamAware.class);
if (paramAwareTag == null) {
throw new JspException(
"The param tag must be a descendant of a tag that supports parameters");
throw new JspException("The param tag must be a descendant of a tag that supports parameters");
}
paramAwareTag.addParam(param);
@@ -67,33 +80,6 @@ public class ParamTag extends BodyTagSupport {
return EVAL_PAGE;
}
// tag attribute accessors
/**
* Sets the name of the parameter
*
* <p>
* Required
*
* @param name the parameter name
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the value of the parameter
*
* <p>
* Optional. If not set, the tag's body content is evaluated
*
* @param value the parameter value
*/
public void setValue(String value) {
this.value = value;
this.valueSet = true;
}
@Override
public void release() {
super.release();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -194,15 +194,18 @@ public class FormTag extends AbstractHtmlElementTag {
}
/**
* Set the value of the '{@code action}' attribute.
* Set the value of the '{@code action}' attribute through a value
* that is to be appended to the current servlet path.
* <p>May be a runtime expression.
* @since 3.2.3
*/
public void setServletRelativeAction(String servletRelativeaction) {
this.servletRelativeAction = (servletRelativeaction != null ? servletRelativeaction : "");
public void setServletRelativeAction(String servletRelativeAction) {
this.servletRelativeAction = (servletRelativeAction != null ? servletRelativeAction : "");
}
/**
* Get the value of the '{@code action}' attribute.
* Get the servlet-relative value of the '{@code action}' attribute.
* @since 3.2.3
*/
protected String getServletRelativeAction() {
return this.servletRelativeAction;
@@ -334,6 +337,7 @@ public class FormTag extends AbstractHtmlElementTag {
return ("get".equalsIgnoreCase(method) || "post".equalsIgnoreCase(method));
}
/**
* Writes the opening part of the block '{@code form}' tag and exposes
* the form object name in the {@link javax.servlet.jsp.PageContext}.

View File

@@ -30,9 +30,6 @@ import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.OrderComparator;
@@ -124,6 +121,10 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
this.contentNegotiationManager = contentNegotiationManager;
}
/**
* Return the {@link ContentNegotiationManager} to use to determine requested media types.
* @since 4.1.9
*/
public ContentNegotiationManager getContentNegotiationManager() {
return this.contentNegotiationManager;
}
@@ -295,6 +296,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
}
}
@Override
public View resolveViewName(String viewName, Locale locale) throws Exception {
RequestAttributes attrs = RequestContextHolder.getRequestAttributes();

View File

@@ -265,7 +265,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -379,7 +379,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will make the HTML element readonly.</description>
<name>readonly</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -459,7 +459,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -573,7 +573,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will make the HTML element readonly.</description>
<name>readonly</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -659,7 +659,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -793,7 +793,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -998,7 +998,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -1144,7 +1144,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.</description>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>