本文整理汇总了Java中org.springframework.extensions.webscripts.AbstractWebScript类的典型用法代码示例。如果您正苦于以下问题:Java AbstractWebScript类的具体用法?Java AbstractWebScript怎么用?Java AbstractWebScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractWebScript类属于org.springframework.extensions.webscripts包,在下文中一共展示了AbstractWebScript类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doRequest
import org.springframework.extensions.webscripts.AbstractWebScript; //导入依赖的package包/类
private MockHttpServletResponse doRequest(AbstractWebScript webScript, Container container, Description description, String method, Map<String, String> parameters, Map<String, String> body,
String webscriptUrl, String controllerMapping, Cookie[] cookies, Map<String, Object> headers) {
webScript.init(container, description);
MockWebScriptResponse mockedResponse = MockWebScriptResponse.createMockWebScriptResponse();
try {
webScript.execute(MockWebscriptServletRequest.createMockWebscriptServletRequest(webScript, method, webscriptUrl, controllerMapping, parameters, body, cookies, headers), mockedResponse);
} catch (IOException e) {
Throwables.propagate(e);
}
return mockedResponse.getMockHttpServletResponse();
}
开发者ID:dgradecak,项目名称:alfresco-mvc,代码行数:14,代码来源:MockWebscript.java
示例2: createMockWebscriptServletRequest
import org.springframework.extensions.webscripts.AbstractWebScript; //导入依赖的package包/类
static public MockWebscriptServletRequest createMockWebscriptServletRequest(AbstractWebScript webScript, String method, String webscriptUrl, String controllerMapping,
final Map<String, String> parameters, final Map<String, String> body, final Cookie[] cookies, final Map<String, Object> headers) {
Match match = new Match(null, ImmutableMap.of("", ""), webscriptUrl, webScript);
MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(method, "http://localhost/alfresco" + webscriptUrl + controllerMapping);
mockHttpServletRequest.setServletPath("alfresco");
mockHttpServletRequest.setContextPath("http://localhost/");
mockHttpServletRequest.setContentType("application/json");
if (parameters != null) {
mockHttpServletRequest.setParameters(parameters);
}
if (cookies != null) {
mockHttpServletRequest.setCookies(cookies);
}
if (headers != null && !headers.isEmpty()) {
for (Entry<String, Object> headerEntry : headers.entrySet()) {
mockHttpServletRequest.addHeader(headerEntry.getKey(), headerEntry.getValue());
}
}
try {
if (HttpMethod.POST.name().equals(method) && body != null) {
mockHttpServletRequest.setContent(new ObjectMapper().writeValueAsString(body).getBytes());
}
} catch (JsonProcessingException e) {
Throwables.propagate(e);
}
MockWebscriptServletRequest webscriptServletRequest = new MockWebscriptServletRequest(mock(Runtime.class), mockHttpServletRequest, match);
// if (content != null && !content.isEmpty()) {
// Content mockedContent = mock(Content.class);
// webscriptServletRequest.content = mockedContent;
// }
return webscriptServletRequest;
}
开发者ID:dgradecak,项目名称:alfresco-mvc,代码行数:35,代码来源:MockWebscriptServletRequest.java
示例3: singleWebscript
import org.springframework.extensions.webscripts.AbstractWebScript; //导入依赖的package包/类
static public MockWebscript singleWebscript(final AbstractWebScript webScript) {
return new MockWebscript(webScript);
}
开发者ID:dgradecak,项目名称:alfresco-mvc,代码行数:4,代码来源:MockWebscriptBuilder.java
示例4: MockWebscript
import org.springframework.extensions.webscripts.AbstractWebScript; //导入依赖的package包/类
public MockWebscript(final AbstractWebScript webScript) {
this.webScript = webScript;
}
开发者ID:dgradecak,项目名称:alfresco-mvc,代码行数:4,代码来源:MockWebscript.java
注:本文中的org.springframework.extensions.webscripts.AbstractWebScript类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论