Package org.apache.struts2

Examples of org.apache.struts2.StrutsException


   
                servletContext.setAttribute(ValidatorPlugIn.STOP_ON_ERROR_KEY + '.'
                    + prefix,
                    (this.stopOnFirstError ? Boolean.TRUE : Boolean.FALSE));
            } catch (Exception e) {
                throw new StrutsException(
                    "Cannot load a validator resource from '" + pathnames + "'", e);
            }
        }
    }
View Full Code Here


            }

            resources =  new ValidatorResources(urlArray);
        } catch (SAXException sex) {
            LOG.error("Skipping all validation", sex);
            throw new StrutsException("Skipping all validation because the validation files cannot be loaded", sex);
        }
        return resources;
    }
View Full Code Here

        ActionConfig actionConfig = ctx.getActionInvocation().getProxy().getConfig();
        Action action = null;
        try {
            action = (Action) objectFactory.buildBean(className, null);
        } catch (Exception e) {
            throw new StrutsException("Unable to create the legacy Struts Action", e, actionConfig);
        }
       
        // We should call setServlet() here, but let's stub that out later
       
        Struts1Factory strutsFactory = new Struts1Factory(Dispatcher.getInstance().getConfigurationManager().getConfiguration());
        ActionMapping mapping = strutsFactory.createActionMapping(actionConfig);
        HttpServletRequest request = ServletActionContext.getRequest();
        HttpServletResponse response = ServletActionContext.getResponse();
        ActionForward forward = action.execute(mapping, actionForm, request, response);
       
        ActionMessages messages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
        if (messages != null) {
            for (Iterator i = messages.get(); i.hasNext(); ) {
                ActionMessage msg = (ActionMessage) i.next();
                if (msg.getValues() != null && msg.getValues().length > 0) {
                    addActionMessage(getText(msg.getKey(), Arrays.asList(msg.getValues())));
                } else {
                    addActionMessage(getText(msg.getKey()));
                }
            }
        }
       
        if (forward instanceof WrapperActionForward || actionConfig.getResults().containsKey(forward.getName())) {
            return forward.getName();
        } else {
            throw new StrutsException("Unable to handle action forwards that don't have an associated result", actionConfig);
        }
    }
View Full Code Here

        {
            writer.write( sb.toString() );
        }
        catch ( IOException e )
        {
            throw new StrutsException( "IOError: " + e.getMessage(), e );
        }

        return super.end( writer, body );
    }
View Full Code Here

                }
            }
        } catch (Exception ex) {
            if (LOG.isErrorEnabled())
                LOG.error("Dispatcher initialization failed", ex);
            throw new StrutsException(ex);
        }
    }
View Full Code Here

                mapping = actionMapper.getMapping(servletRequest, dispatcherUtils.getConfigurationManager());
            }
        }

        if (mapping == null) {
            throw new StrutsException("Unable to locate action mapping for request, probably due to an invalid action path: " + actionPath);
        }
        return mapping;
    }
View Full Code Here

                try {
                    objectFactory.getClassInstance(actionClass.getName());
                } catch (ClassNotFoundException e) {
                    if (LOG.isErrorEnabled())
                        LOG.error("Object Factory was unable to load class [#0]", e, actionClass.getName());
                    throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(), e);
                }
            }

            // Determine the action package
            String actionPackage = actionClass.getPackage().getName();
View Full Code Here

            urlComponent.getHttpServletRequest().setAttribute(var, result);
        } else {
            try {
                writer.write(result);
            } catch (IOException e) {
                throw new StrutsException("IOError: " + e.getMessage(), e);
            }
        }
    }
View Full Code Here

            if (!bundles.isEmpty())
                configProps.put(AutoActivator.AUTO_START_PROP + ".2", StringUtils.join(bundles, " "));
        } else {
            for (String runLevel : runLevels.keySet()) {
                 if ("1".endsWith(runLevel))
                    throw new StrutsException("Run level dirs must be greater than 1. Run level 1 is reserved for the Felix bundles");
                List<String> bundles = getBundlesInDir(runLevels.get(runLevel));
                configProps.put(AutoActivator.AUTO_START_PROP + "." + runLevel, StringUtils.join(bundles, " "));
            }
        }
    }
View Full Code Here

        try {
            velocityEngine.init(p);
        } catch (Exception e) {
            String gripe = "Unable to instantiate VelocityEngine!";
            throw new StrutsException(gripe, e);
        }

        return velocityEngine;
    }
View Full Code Here

TOP

Related Classes of org.apache.struts2.StrutsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.