use of org.springframework.web.servlet.support.RequestDataValueProcessor in project spring-framework by spring-projects.
the class UrlTag method doEndTag.
@Override
public int doEndTag() throws JspException {
String url = createUrl();
RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
ServletRequest request = this.pageContext.getRequest();
if ((processor != null) && (request instanceof HttpServletRequest)) {
url = processor.processUrl((HttpServletRequest) request, url);
}
if (this.var == null) {
// print the url to the writer
try {
pageContext.getOut().print(url);
} catch (IOException ex) {
throw new JspException(ex);
}
} else {
// store the url as a variable
pageContext.setAttribute(var, url, scope);
}
return EVAL_PAGE;
}
use of org.springframework.web.servlet.support.RequestDataValueProcessor in project spring-framework by spring-projects.
the class AbstractDataBoundFormElementTag method processFieldValue.
/**
* Process the given form field through a {@link RequestDataValueProcessor}
* instance if one is configured or otherwise returns the same value.
*/
protected final String processFieldValue(String name, String value, String type) {
RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
ServletRequest request = this.pageContext.getRequest();
if (processor != null && (request instanceof HttpServletRequest)) {
value = processor.processFormFieldValue((HttpServletRequest) request, name, value, type);
}
return value;
}
use of org.springframework.web.servlet.support.RequestDataValueProcessor in project spring-framework by spring-projects.
the class FormTag method doEndTag.
/**
* Closes the '{@code form}' block tag and removes the form object name
* from the {@link javax.servlet.jsp.PageContext}.
*/
@Override
public int doEndTag() throws JspException {
RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
ServletRequest request = this.pageContext.getRequest();
if ((processor != null) && (request instanceof HttpServletRequest)) {
writeHiddenFields(processor.getExtraHiddenFields((HttpServletRequest) request));
}
this.tagWriter.endTag();
return EVAL_PAGE;
}
use of org.springframework.web.servlet.support.RequestDataValueProcessor in project spring-framework by spring-projects.
the class AbstractHtmlElementTagTests method getMockRequestDataValueProcessor.
@SuppressWarnings("deprecation")
protected RequestDataValueProcessor getMockRequestDataValueProcessor() {
RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
HttpServletRequest request = (HttpServletRequest) getPageContext().getRequest();
StaticWebApplicationContext wac = (StaticWebApplicationContext) RequestContextUtils.findWebApplicationContext(request);
wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);
return mockProcessor;
}
Aggregations