use of org.apache.struts.chain.contexts.ServletActionContext in project sonarqube by SonarSource.
the class CreateActionForm method execute.
// ---------------------------------------------------------- Public Methods
/**
* <p>Create (if necessary) and cache a form bean for this request.</p>
*
* @param actionCtx The <code>Context</code> for the current request
* @return <code>false</code> so that processing continues
* @throws Exception on any error
*/
public boolean execute(ActionContext actionCtx) throws Exception {
// Is there a form bean associated with this ActionConfig?
ActionConfig actionConfig = actionCtx.getActionConfig();
String name = actionConfig.getName();
if (name == null) {
actionCtx.setActionForm(null);
return (false);
}
if (LOG.isTraceEnabled()) {
LOG.trace("Look up form-bean " + name);
}
// Look up the corresponding FormBeanConfig (if any)
FormBeanConfig formBeanConfig = actionConfig.getModuleConfig().findFormBeanConfig(name);
if (formBeanConfig == null) {
LOG.warn("No FormBeanConfig found in module " + actionConfig.getModuleConfig().getPrefix() + " under name " + name);
actionCtx.setActionForm(null);
return (false);
}
Map scope = actionCtx.getScope(actionConfig.getScope());
ActionForm instance;
instance = (ActionForm) scope.get(actionConfig.getAttribute());
// Can we recycle the existing instance (if any)?
if (!formBeanConfig.canReuse(instance)) {
instance = formBeanConfig.createActionForm(actionCtx);
}
// directly depends on ActionServlet
if (actionCtx instanceof ServletActionContext) {
// The servlet property of ActionForm is transient, so
// ActionForms which are restored from a serialized state
// need to have their servlet restored.
ServletActionContext sac = (ServletActionContext) actionCtx;
instance.setServlet(sac.getActionServlet());
}
actionCtx.setActionForm(instance);
scope.put(actionConfig.getAttribute(), instance);
return (false);
}
use of org.apache.struts.chain.contexts.ServletActionContext in project sonarqube by SonarSource.
the class PerformInclude method includePath.
protected String includePath(ActionContext actionContext, String include) {
ServletActionContext swcontext = (ServletActionContext) actionContext;
String actionIdPath = RequestUtils.actionIdURL(include, swcontext.getModuleConfig(), swcontext.getActionServlet());
if (actionIdPath != null) {
return super.includePath(actionContext, actionIdPath);
} else {
return super.includePath(actionContext, include);
}
}
use of org.apache.struts.chain.contexts.ServletActionContext in project sonarqube by SonarSource.
the class PerformInclude method perform.
// ------------------------------------------------------- Protected Methods
/**
* <p>Perform the appropriate processing on the specified include
* uri.</p>
*
* @param context The context for this request
* @param uri The uri to be included
*/
protected void perform(ActionContext context, String uri) throws Exception {
ServletActionContext swcontext = (ServletActionContext) context;
HttpServletRequest request = swcontext.getRequest();
RequestDispatcher rd = swcontext.getContext().getRequestDispatcher(uri);
rd.forward(request, swcontext.getResponse());
}
use of org.apache.struts.chain.contexts.ServletActionContext in project sonarqube by SonarSource.
the class RequestNoCache method requestNoCache.
// ------------------------------------------------------- Protected Methods
protected void requestNoCache(ActionContext context) {
ServletActionContext sacontext = (ServletActionContext) context;
HttpServletResponse response = sacontext.getResponse();
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache,no-store,max-age=0");
response.setDateHeader("Expires", 1);
}
use of org.apache.struts.chain.contexts.ServletActionContext in project sonarqube by SonarSource.
the class SetContentType method setContentType.
// ------------------------------------------------------- Protected Methods
protected void setContentType(ActionContext context, String contentType) {
ServletActionContext swcontext = (ServletActionContext) context;
HttpServletResponse response = swcontext.getResponse();
response.setContentType(contentType);
}
Aggregations