if (getCatalog() == null) { setCatalog(config.getCatalog()); if (getCommand() == null) { setCommand(config.getCommand()); if (getModule() == null) { setModule(config.getModule()); if (getName() == null) { setName(config.getName()); if (getPath() == null) { setPath(config.getPath()); if (!getRedirect()) { setRedirect(config.getRedirect()); inheritProperties(config);
/** * <p>Construct a new instance based on the values of another ActionForward.</p> * * @param copyMe An ActionForward instance to copy * @since Struts 1.2.1 */ public ActionForward(ActionForward copyMe) { this(copyMe.getName(),copyMe.getPath(),copyMe.getRedirect(),copyMe.getModule()); setContextRelative(copyMe.getContextRelative()); }
/** * <p>Construct a new instance with the specified * <code>path</code> and <code>redirect</code> flag.</p> * * @param path Path for this instance * @param redirect Redirect flag for this instance */ public ActionForward(String path, boolean redirect) { super(); setName(null); setPath(path); setRedirect(redirect); }
/** * <p>Construct a new instance based on the values of another * ForwardConfig.</p> * * @param copyMe A ForwardConfig instance to copy * @since Struts 1.3.6 */ public ForwardConfig(ForwardConfig copyMe) { this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(), copyMe.getModule()); }
/** * <p>Construct a new instance with a {@link ForwardConfig} object * to copy name, path, and contextRelative values from.</p> * * @param baseConfig the {@link ForwardConfig} * to copy configuration values from */ public ActionRedirect(ForwardConfig baseConfig) { setName(baseConfig.getName()); setPath(baseConfig.getPath()); setContextRelative(baseConfig.getContextRelative()); setModule(baseConfig.getModule()); setRedirect(true); initializeParameters(); }
String forwardPath = forward.getPath(); String uri; if (actionIdPath != null) { forwardPath = actionIdPath; ForwardConfig actionIdForward = new ForwardConfig(forward); actionIdForward.setPath(actionIdPath); forward = actionIdForward; if (forward.getRedirect()) {
for (int x = 0; x < fConfigs.length; x++) { cfg = new ActionForward(); cfg.setContextRelative(fConfigs[x].getContextRelative()); cfg.setName(fConfigs[x].getName()); cfg.setPath(convertParam(fConfigs[x].getPath(), vars)); cfg.setRedirect(fConfigs[x].getRedirect()); config.removeForwardConfig(fConfigs[x]); config.addForwardConfig(cfg);
/** * <p>Return <code>true</code> if information returned by * <code>config.findForwardConfigs</code> is all valid; otherwise, log * error messages and return <code>false</code>.</p> */ protected boolean verifyForwardConfigs() { boolean ok = true; ForwardConfig[] fcs = config.findForwardConfigs(); for (int i = 0; i < fcs.length; i++) { String path = fcs[i].getPath(); if (path == null) { LOG.error(servlet.getInternal().getMessage("verifyForwardConfigs.missing", fcs[i].getName())); ok = false; } else if (!path.startsWith("/")) { LOG.error(servlet.getInternal().getMessage("verifyForwardConfigs.invalid", path, fcs[i].getName())); } } return (ok); }
public class CustomizedTileProcessor extends TilesRequestProcessor { @Override protected void processForwardConfig(HttpServletRequest pRequest, HttpServletResponse pResponse, ForwardConfig pForward) throws IOException, ServletException { if(isChromeBrowser(pRequest)) { ForwardConfig newForward = new ForwardConfig(pForward.getName(), pForward.getPath()+"_chrome", pForward.getRedirect(), pForward.getContextRelative()); super.processForwardConfig(pRequest, pResponse, newForward); } else { super.processForwardConfig(pRequest, pResponse, pForward); } } }
/** * Construct a new instance with the specified values. * * @param name Name of this forward * @param path Path to which control should be forwarded or redirected * @param redirect Should we do a redirect? * @param module Module prefix, if any */ public ActionForward(String name, String path, boolean redirect, String module) { super(); setName(name); setPath(path); setRedirect(redirect); setModule(module); }
/** * <p> Remove the specified forward configuration instance. </p> * * @param config ForwardConfig instance to be removed * @throws IllegalStateException if this module configuration has been * frozen */ public void removeForwardConfig(ForwardConfig config) { if (configured) { throw new IllegalStateException("Configuration is frozen"); } forwards.remove(config.getName()); }
/** * <p>Get the original path without the parameters added at runtime.</p> * * @return the original path as configured. */ public String getOriginalPath() { return super.getPath(); }
/** * Construct a new instance with the specified values. * * @param name Name of this forward * @param path Path to which control should be forwarded or redirected * @param redirect Should we do a redirect? * @param contextRelative Is this path context relative? * @deprecated Use module rather than contextRelative */ public ForwardConfig(String name, String path, boolean redirect, boolean contextRelative) { super(); setName(name); setPath(path); setRedirect(redirect); setContextRelative(contextRelative); }
/** * <p>Construct a new instance with a {@link ForwardConfig} object to copy * name, path, contextRelative, and arbitrary property values from.</p> * * @param baseConfig the {@link ForwardConfig} to copy configuration * values from */ public ActionRedirect(ForwardConfig baseConfig) { setName(baseConfig.getName()); setPath(baseConfig.getPath()); setModule(baseConfig.getModule()); setRedirect(true); inheritProperties(baseConfig); initializeParameters(); }
String ancestorName = getExtends(); (this != moduleConfig.findForwardConfig(getName())); checkActionConfig &= !ancestorName.equals(getName()); if (checkCircularInheritance(moduleConfig, actionConfig)) { throw new IllegalArgumentException( "Circular inheritance detected for forward " + getName()); if (!baseConfig.isExtensionProcessed()) { baseConfig.processExtends(moduleConfig, actionConfig); inheritFrom(baseConfig);
String forwardPath = forward.getPath(); String uri = null; if (forward.getRedirect()) {
/** * <p>Returns the true path of the destination action if the specified forward * is an action-aliased URL. This method version forms the URL based on * the current request; selecting the current module if the forward does not * explicitly contain a module path.</p> * * @param forward the forward config * @param request the current request * @param servlet the servlet handling the current request * @return the context-relative URL of the action if the forward has an action identifier; otherwise <code>null</code>. * @since Struts 1.3.6 */ public static String actionIdURL(ForwardConfig forward, HttpServletRequest request, ActionServlet servlet) { ModuleConfig moduleConfig = null; if (forward.getModule() != null) { String prefix = forward.getModule(); moduleConfig = ModuleUtils.getInstance().getModuleConfig(prefix, servlet.getServletContext()); } else { moduleConfig = ModuleUtils.getInstance().getModuleConfig(request); } return actionIdURL(forward.getPath(), moduleConfig, servlet); }
throws ServletException { try { if (!forwardConfig.isExtensionProcessed()) { if (log.isDebugEnabled()) { log.debug("Processing extensions for '" + forwardConfig.getName() + "'"); actionConfig); forwardConfig.processExtends(moduleConfig, actionConfig); handleGeneralExtensionException("Forward", forwardConfig.getName(), e);
String path = forward.getPath(); if(forward.getModule() != null) { prefix = forward.getModule(); if ("/".equals(prefix)) { prefix = ""; if (forward.getContextRelative()) { if (!path.startsWith("/")) { sb.append("/");
protected void addForwardConfig(ModuleConfig config, String path, ActionConfig actionConfig) { ForwardConfig forwardConfig = (ForwardConfig) ClassUtil.newInstance(config.getActionForwardClass()); forwardConfig.setName(Constants.SUCCESS); forwardConfig.setPath(path); actionConfig.addForwardConfig(forwardConfig); }