本文整理了Java中org.apache.struts2.dispatcher.Dispatcher.getInstance()
方法的一些代码示例,展示了Dispatcher.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dispatcher.getInstance()
方法的具体详情如下:
包路径:org.apache.struts2.dispatcher.Dispatcher
类名称:Dispatcher
方法名:getInstance
暂无
代码示例来源:origin: org.apache.struts/struts2-spring-plugin
private void reload(File file) {
if (classLoader != null) {
LOG.debug("Change detected in file [{}], reloading class loader", file.getAbsolutePath());
classLoader.reload();
if (reloadConfig && Dispatcher.getInstance() != null) {
LOG.debug("Change detected in file [{}], reloading configuration", file.getAbsolutePath());
Dispatcher.getInstance().getConfigurationManager().reload();
}
}
}
代码示例来源:origin: com.googlecode.struts2-conversation/struts2-conversation-scope-plugin
protected static String getActionSuffix() {
if (actionSuffix == null) {
actionSuffix = Dispatcher
.getInstance()
.getContainer()
.getInstance(String.class,
ConventionConstants.ACTION_SUFFIX);
}
return actionSuffix;
}
代码示例来源:origin: com.googlecode.struts2-conversation/struts2-junit4-plugin
/**
* Injects dependencies on an Object using Struts internal IoC container
*/
protected void injectStrutsDependencies(Object object) {
Dispatcher.getInstance().getContainer().inject(object);
}
代码示例来源:origin: com.googlecode.struts2-conversation/struts2-conversation-scope-plugin
public static ConversationConfigurationProvider getConfigurationProvider() {
if (configurationProvider == null) {
configurationProvider = Dispatcher
.getInstance()
.getContainer()
.getInstance(ScopeContainerProvider.class).getScopeContainer().getComponent(ConversationConfigurationProvider.class);
}
return configurationProvider;
}
代码示例来源:origin: OneBusAway/onebusaway-application-modules
public static String url(String value) {
Dispatcher instance = Dispatcher.getInstance();
if( instance == null)
return null;
Container container = instance.getContainer();
UrlFunction function = new UrlFunction();
container.inject(function);
return function.getUrl(value);
}
}
代码示例来源:origin: org.onebusaway/onebusaway-presentation
public static String resource(String resourcePath) {
Dispatcher instance = Dispatcher.getInstance();
if (instance == null)
return null;
Container container = instance.getContainer();
ResourceUrlFunction function = new ResourceUrlFunction();
container.inject(function);
return function.getExternalUrlForResource(resourcePath);
}
}
代码示例来源:origin: OneBusAway/onebusaway-application-modules
public static String resource(String resourcePath) {
Dispatcher instance = Dispatcher.getInstance();
if (instance == null)
return null;
Container container = instance.getContainer();
ResourceUrlFunction function = new ResourceUrlFunction();
container.inject(function);
return function.getExternalUrlForResource(resourcePath);
}
}
代码示例来源:origin: org.onebusaway/onebusaway-presentation
public static String url(String value) {
Dispatcher instance = Dispatcher.getInstance();
if( instance == null)
return null;
Container container = instance.getContainer();
UrlFunction function = new UrlFunction();
container.inject(function);
return function.getUrl(value);
}
}
代码示例来源:origin: OneBusAway/onebusaway-application-modules
public static String configValue(String key) {
Dispatcher instance = Dispatcher.getInstance();
if (instance == null)
return null;
Container container = instance.getContainer();
ConfigurationValueFunction cv = new ConfigurationValueFunction();
container.inject(cv);
return cv.lookup(key);
}
代码示例来源:origin: com.googlecode.struts2-conversation/struts2-junit4-plugin
/**
* Executes an action and returns it's output (not the result returned from
* execute()), but the actual output that would be written to the response.
* For this to work the configured result for the action needs to be
* FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
*/
protected String executeAction(String uri) throws ServletException, UnsupportedEncodingException {
request.setRequestURI(uri);
ActionMapping mapping = getActionMapping(request);
assertNotNull(mapping);
Dispatcher.getInstance().serviceAction(request, response, servletContext, mapping);
if (response.getStatus() != HttpServletResponse.SC_OK)
throw new ServletException("Error code [" + response.getStatus() + "], Error: [" + response.getErrorMessage() + "]");
return response.getContentAsString();
}
代码示例来源:origin: org.onebusaway/onebusaway-wiki-integration-xwiki-struts-macros
public List<Block> execute(T parameters, String content,
MacroTransformationContext context) throws MacroExecutionException {
ActionContext actionContext = ActionContext.getContext();
ValueStack stack = actionContext.getValueStack();
V component = getBean(stack);
Container container = Dispatcher.getInstance().getContainer();
container.inject(component);
populateParams(component, parameters);
if (content == null)
content = "";
if (parameters.isWiki() && content.trim().length() > 0)
content = renderWikiSyntax(content, context);
StringWriter writer = new StringWriter();
boolean evaluateBody = component.start(writer);
if (!evaluateBody)
content = "";
component.end(writer, content);
List<Block> wordBlockAsList = Arrays.<Block> asList(new RawBlock(
writer.toString(), XHTML_SYNTAX));
// Handle both inline mode and standalone mode.
if (context.isInline()) {
return wordBlockAsList;
} else {
// Wrap the result in a Paragraph Block since a WordBlock is an inline
// element and it needs to be
// inside a standalone block.
return Arrays.<Block> asList(new ParagraphBlock(wordBlockAsList));
}
}
代码示例来源:origin: org.apache.struts/struts2-junit-plugin
/**
* Executes an action and returns it's output (not the result returned from
* execute()), but the actual output that would be written to the response.
* For this to work the configured result for the action needs to be
* FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
*/
protected String executeAction(String uri) throws ServletException, UnsupportedEncodingException {
request.setRequestURI(uri);
ActionMapping mapping = getActionMapping(request);
assertNotNull(mapping);
Dispatcher.getInstance().serviceAction(request, response, mapping);
if (response.getStatus() != HttpServletResponse.SC_OK) {
throw new ServletException("Error code [" + response.getStatus() + "], Error: [" + response.getErrorMessage() + "]");
}
return response.getContentAsString();
}
代码示例来源:origin: org.apache.struts/struts2-junit-plugin
/**
* Executes an action and returns it's output (not the result returned from
* execute()), but the actual output that would be written to the response.
* For this to work the configured result for the action needs to be
* FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
*/
protected String executeAction(String uri) throws ServletException, UnsupportedEncodingException {
request.setRequestURI(uri);
ActionMapping mapping = getActionMapping(request);
assertNotNull(mapping);
Dispatcher.getInstance().serviceAction(request, response, mapping);
if (response.getStatus() != HttpServletResponse.SC_OK)
throw new ServletException("Error code [" + response.getStatus() + "], Error: ["
+ response.getErrorMessage() + "]");
return response.getContentAsString();
}
代码示例来源:origin: org.apache.struts/struts2-junit-plugin
/**
* Executes an action and returns it's output (not the result returned from
* execute()), but the actual output that would be written to the response.
* For this to work the configured result for the action needs to be JSON,
* FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
*
* @param httpMethod HTTP method of request like GET, POST, PUT or DELETE
* @param uri action uri to test
* @return execution result
*
* @throws ServletException in case of servlet errors
* @throws UnsupportedEncodingException in case of unsupported encoding
*/
protected String executeAction(String httpMethod, String uri) throws ServletException, UnsupportedEncodingException {
request.setRequestURI(uri);
request.setMethod(httpMethod);
ActionMapping mapping = getActionMapping(request);
assertNotNull(mapping);
Dispatcher.getInstance().serviceAction(request, response, mapping);
if (response.getStatus() != HttpServletResponse.SC_OK)
throw new ServletException("Error code [" + response.getStatus() + "], Error: ["
+ response.getErrorMessage() + "]");
return response.getContentAsString();
}
代码示例来源:origin: org.apache.struts/struts2-sitemesh-plugin
if (ctx == null) {
ValueStack vs = Dispatcher.getInstance().getContainer().getInstance(ValueStackFactory.class).createValueStack();
vs.getContext().putAll(Dispatcher.getInstance().createContextMap(request, response, null));
ctx = new ActionContext(vs.getContext());
if (ctx.getActionInvocation() == null) {
代码示例来源:origin: org.apache.struts/struts2-struts1-plugin
Struts1Factory strutsFactory = new Struts1Factory(Dispatcher.getInstance().getConfigurationManager().getConfiguration());
ActionMapping mapping = strutsFactory.createActionMapping(actionConfig);
HttpServletRequest request = ServletActionContext.getRequest();
代码示例来源:origin: org.apache.struts/struts2-dwr-plugin
Map session = new SessionMap(req);
Map application = new ApplicationMap(servletContext);
Dispatcher du = Dispatcher.getInstance();
HashMap<String, Object> ctx = du.createContextMap(requestMap,
requestParams.build(),
内容来源于网络,如有侵权,请联系作者删除!