• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RequestDataValueProcessor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.web.servlet.support.RequestDataValueProcessor的典型用法代码示例。如果您正苦于以下问题:Java RequestDataValueProcessor类的具体用法?Java RequestDataValueProcessor怎么用?Java RequestDataValueProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequestDataValueProcessor类属于org.springframework.web.servlet.support包,在下文中一共展示了RequestDataValueProcessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateTargetUrl

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:RedirectView.java


示例2: doEndTag

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:26,代码来源:UrlTag.java


示例3: updateTargetUrl

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@Test
public void updateTargetUrl() throws Exception {
	StaticWebApplicationContext wac = new StaticWebApplicationContext();
	wac.registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class);
	wac.setServletContext(new MockServletContext());
	wac.refresh();

	RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
	wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);

	RedirectView rv = new RedirectView();
	rv.setApplicationContext(wac);	// Init RedirectView with WebAppCxt
	rv.setUrl("/path");

	MockHttpServletRequest request = createRequest();
	request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
	HttpServletResponse response = new MockHttpServletResponse();

	given(mockProcessor.processUrl(request, "/path")).willReturn("/path?key=123");

	rv.render(new ModelMap(), request, response);

	verify(mockProcessor).processUrl(request, "/path");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:25,代码来源:RedirectViewTests.java


示例4: requestDataValueProcessorHooks

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@Test
public void requestDataValueProcessorHooks() throws Exception {
	String action = "/my/form?foo=bar";
	RequestDataValueProcessor processor = getMockRequestDataValueProcessor();
	given(processor.processAction(this.request, action, "post")).willReturn(action);
	given(processor.getExtraHiddenFields(this.request)).willReturn(Collections.singletonMap("key", "value"));

	this.tag.doStartTag();
	this.tag.doEndTag();
	this.tag.doFinally();

	String output = getOutput();

	assertEquals("<div>\n<input type=\"hidden\" name=\"key\" value=\"value\" />\n</div>", getInputTag(output));
	assertFormTagOpened(output);
	assertFormTagClosed(output);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:FormTagTests.java


示例5: testRequestDataValueProcessorHooks

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
public void testRequestDataValueProcessorHooks() throws Exception {
	String action = "/my/form?foo=bar";
	RequestDataValueProcessor processor = getMockRequestDataValueProcessor();
	given(processor.processAction(this.request, action)).willReturn(action);
	given(processor.getExtraHiddenFields(this.request)).willReturn(Collections.singletonMap("key", "value"));

	this.tag.doStartTag();
	this.tag.doEndTag();
	this.tag.doFinally();

	String output = getOutput();

	assertEquals("<input type=\"hidden\" name=\"key\" value=\"value\" />", getInputTag(output));
	assertFormTagOpened(output);
	assertFormTagClosed(output);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:17,代码来源:FormTagTests.java


示例6: processAction

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * Process the action through a {@link RequestDataValueProcessor} instance
 * if one is configured or otherwise returns the action unmodified.
 */
private String processAction(String action) {
	RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
	ServletRequest request = this.pageContext.getRequest();
	if (processor != null && request instanceof HttpServletRequest) {
		action = processor.processAction((HttpServletRequest) request, action, getHttpMethod());
	}
	return action;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:FormTag.java


示例7: doEndTag

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:FormTag.java


示例8: processFieldValue

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:AbstractDataBoundFormElementTag.java


示例9: updateTargetUrlWithContextLoader

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@Test
public void updateTargetUrlWithContextLoader() throws Exception {
	StaticWebApplicationContext wac = new StaticWebApplicationContext();
	wac.registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class);

	MockServletContext servletContext = new MockServletContext();
	ContextLoader contextLoader = new ContextLoader(wac);
	contextLoader.initWebApplicationContext(servletContext);

	try {
		RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
		wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);

		RedirectView rv = new RedirectView();
		rv.setUrl("/path");

		MockHttpServletRequest request = createRequest();
		HttpServletResponse response = new MockHttpServletResponse();

		given(mockProcessor.processUrl(request, "/path")).willReturn("/path?key=123");

		rv.render(new ModelMap(), request, response);

		verify(mockProcessor).processUrl(request, "/path");
	}
	finally {
		contextLoader.closeWebApplicationContext(servletContext);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:RedirectViewTests.java


示例10: getMockRequestDataValueProcessor

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected RequestDataValueProcessor getMockRequestDataValueProcessor() {
	RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
	ServletRequest request = getPageContext().getRequest();
	StaticWebApplicationContext wac = (StaticWebApplicationContext) RequestContextUtils.getWebApplicationContext(request);
	wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);
	return mockProcessor;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:AbstractHtmlElementTagTests.java


示例11: processAction

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * Process the action through a {@link RequestDataValueProcessor} instance
 * if one is configured or otherwise returns the action unmodified.
 */
private String processAction(String action) {
	RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
	ServletRequest request = this.pageContext.getRequest();
	if (processor != null && request instanceof HttpServletRequest) {
		action = processor.processAction((HttpServletRequest) request, action);
	}
	return action;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:13,代码来源:FormTag.java


示例12: getMockRequestDataValueProcessor

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
protected RequestDataValueProcessor getMockRequestDataValueProcessor() {
	RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
	ServletRequest request = getPageContext().getRequest();
	StaticWebApplicationContext wac = (StaticWebApplicationContext) RequestContextUtils.getWebApplicationContext(request);
	wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);
	return mockProcessor;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:AbstractHtmlElementTagTests.java


示例13: processAction

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
     * <p>
     * {@code Spring MVC} のパス修飾機構によって指定されたURLパスを修飾します。<br/>
     * </p>
     * @param action パス
     * @param requestContext {@link RequestContext} インスタンス
     * @param pageContext {@link PageContext} インスタンス
     * @return 修飾されたパス
     */
    public static String processAction(String action, RequestContext requestContext, PageContext pageContext) {
        RequestDataValueProcessor processor = requestContext.getRequestDataValueProcessor();
        ServletRequest request = pageContext.getRequest();
        if ((processor != null) && (request instanceof HttpServletRequest)) {
//            return processor.processAction((HttpServletRequest) request, action);
            return processor.processAction((HttpServletRequest) request, action, ((HttpServletRequest) request).getMethod());
        }
        return action;
    }
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:19,代码来源:TagUtils.java


示例14: getExtraHiddenFields

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Map<String, String> getExtraHiddenFields(HttpServletRequest request) {
    Map<String, String> extraHiddenFields = new HashMap<String, String>();
    for (RequestDataValueProcessor requestDataValueProcessor : requestDataValueProcessors) {
        Map<String, String> m = requestDataValueProcessor.getExtraHiddenFields(request);
        if (m != null) {
            extraHiddenFields.putAll(m);
        }
    }
    return extraHiddenFields;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:15,代码来源:JseRequestDataValueProcessor.java


示例15: processUrl

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String processUrl(HttpServletRequest request, String url) {
    for (RequestDataValueProcessor requestDataValueProcessor : requestDataValueProcessors) {
        url = requestDataValueProcessor.processUrl(request, url);
    }
    return url;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:11,代码来源:JseRequestDataValueProcessor.java


示例16: testValidTemplateName

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * @param mergeTemplateFailureException may be null in which case mergeTemplate override will succeed.
 * If it's non null it will be checked
 */
private void testValidTemplateName(final Exception mergeTemplateFailureException) throws Exception {
	Map<String, Object> model = new HashMap<String, Object>();
	model.put("foo", "bar");

	final String templateName = "test.vm";

	WebApplicationContext wac = mock(WebApplicationContext.class);
	MockServletContext sc = new MockServletContext();
	sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

	final Template expectedTemplate = new Template();
	VelocityConfig vc = new VelocityConfig() {
		@Override
		public VelocityEngine getVelocityEngine() {
			return new TestVelocityEngine(templateName, expectedTemplate);
		}
	};
	Map<String, VelocityConfig> configurers = new HashMap<String, VelocityConfig>();
	configurers.put("velocityConfigurer", vc);
	given(wac.getBeansOfType(VelocityConfig.class, true, false)).willReturn(configurers);
	given(wac.getServletContext()).willReturn(sc);
	given(wac.getBean("requestDataValueProcessor",
			RequestDataValueProcessor.class)).willReturn(null);

	HttpServletRequest request = new MockHttpServletRequest();
	final HttpServletResponse expectedResponse = new MockHttpServletResponse();

	VelocityView vv = new VelocityView() {
		@Override
		protected void mergeTemplate(Template template, Context context, HttpServletResponse response) throws Exception {
			assertTrue(template == expectedTemplate);
			assertTrue(context.getKeys().length >= 1);
			assertTrue(context.get("foo").equals("bar"));
			assertTrue(response == expectedResponse);
			if (mergeTemplateFailureException != null) {
				throw mergeTemplateFailureException;
			}
		}
	};
	vv.setUrl(templateName);
	vv.setApplicationContext(wac);

	try {
		vv.render(model, request, expectedResponse);
		if (mergeTemplateFailureException != null) {
			fail();
		}
	}
	catch (Exception ex) {
		assertNotNull(mergeTemplateFailureException);
		assertEquals(ex, mergeTemplateFailureException);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:58,代码来源:VelocityViewTests.java


示例17: requestDataValueProcessor

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
@Bean
public RequestDataValueProcessor requestDataValueProcessor() {
    return new CsrfRequestDataValueProcessor();
}
 
开发者ID:jchampemont,项目名称:notedown,代码行数:5,代码来源:WebSecurityConfiguration.java


示例18: setRequestDataValueProcessor

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
public void setRequestDataValueProcessor(RequestDataValueProcessor processor) {
	this.processor = processor;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:RequestDataValueProcessorWrapper.java


示例19: processUrl

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * <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;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:18,代码来源:TagUtils.java


示例20: setRequestDataValueProcessors

import org.springframework.web.servlet.support.RequestDataValueProcessor; //导入依赖的package包/类
/**
 * {@link RequestDataValueProcesso} インスタンスのリストを設定します。
 * @param requestDataValueProcessors {@link RequestDataValueProcesso} インスタンスのリスト
 */
public void setRequestDataValueProcessors(List<RequestDataValueProcessor> requestDataValueProcessors) {
    this.requestDataValueProcessors = requestDataValueProcessors;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:8,代码来源:JseRequestDataValueProcessor.java



注:本文中的org.springframework.web.servlet.support.RequestDataValueProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RMAppRejectedEvent类代码示例发布时间:2022-05-23
下一篇:
Java Maps类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap