Java Code Examples for org.springframework.web.servlet.support.RequestDataValueProcessor#processUrl()

The following examples show how to use org.springframework.web.servlet.support.RequestDataValueProcessor#processUrl() . 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: RedirectView.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 2
Source File: UrlTag.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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 {
			this.pageContext.getOut().print(url);
		}
		catch (IOException ex) {
			throw new JspException(ex);
		}
	}
	else {
		// store the url as a variable
		this.pageContext.setAttribute(this.var, url, this.scope);
	}
	return EVAL_PAGE;
}
 
Example 3
Source File: RedirectView.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 4
Source File: UrlTag.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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 {
			this.pageContext.getOut().print(url);
		}
		catch (IOException ex) {
			throw new JspException(ex);
		}
	}
	else {
		// store the url as a variable
		this.pageContext.setAttribute(this.var, url, this.scope);
	}
	return EVAL_PAGE;
}
 
Example 5
Source File: RedirectView.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 6
Source File: UrlTag.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 7
Source File: RedirectView.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 8
Source File: UrlTag.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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 e) {
			throw new JspException(e);
		}
	}
	else {
		// store the url as a variable
		pageContext.setAttribute(var, url, scope);
	}
	return EVAL_PAGE;
}
 
Example 9
Source File: JseRequestDataValueProcessor.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String processUrl(HttpServletRequest request, String url) {
    for (RequestDataValueProcessor requestDataValueProcessor : requestDataValueProcessors) {
        url = requestDataValueProcessor.processUrl(request, url);
    }
    return url;
}
 
Example 10
Source File: TagUtils.java    From sinavi-jfw with Apache License 2.0 3 votes vote down vote up
/**
 * <p>
 * {@code Spring MVC} のパス修飾機構によって指定されたURLパスを修飾します。<br/>
 * </p>
 * @param url パス
 * @param requestContext {@link RequestContext} インスタンス
 * @param pageContext {@link PageContext} インスタンス
 * @return 修飾されたパス
 */
public static String processUrl(String url, RequestContext requestContext, PageContext pageContext) {
    RequestDataValueProcessor processor = requestContext.getRequestDataValueProcessor();
    ServletRequest request = pageContext.getRequest();
    if ((processor != null) && (request instanceof HttpServletRequest)) {
        return processor.processUrl((HttpServletRequest) request, url);
    }
    return url;
}