Package org.apache.struts2

Examples of org.apache.struts2.StrutsException


        assert(body != null);

        try {
            writer.write(body);
        } catch (IOException e) {
            throw new StrutsException("IOError while writing the body: " + e.getMessage(), e);
        }
        if (popComponentStack) {
            popComponentStack();
        }
        return false;
View Full Code Here


     */
    protected StrutsException fieldError(String field, String errorMsg, Exception e) {
        String msg = "tag '" + getComponentName() + "', field '" + field +
                ( parameters != null && parameters.containsKey("name")?"', name '" + parameters.get("name"):"") +
                "': " + errorMsg;
        throw new StrutsException(msg, e);
    }
View Full Code Here

                ((UnnamedParametric) component).addParameter(findValue(value));
            } else {
                String name = findString(this.name);

                if (name == null) {
                    throw new StrutsException("No name found for following expression: " + this.name);
                }

                Object value = findValue(this.value);
                if (suppressEmptyParameters) {
                    String potentialValue = (String) value;
View Full Code Here

    public void prepare() {
        if (writer == null) {
            try {
                writer = new FileWriter(output + "/out.dot");
            } catch (IOException e) {
                throw new StrutsException(e);
            }
        }

        StrutsConfigRetriever.setConfiguration(configDir, views.split("[,]+"));
        DOTRenderer renderer = new DOTRenderer(writer);
View Full Code Here

        osgiHost = OsgiHostFactory.createOsgiHost(platform);
        servletContext.setAttribute(OSGI_HOST, osgiHost);
        try {
            osgiHost.init(servletContext);
        } catch (Exception e) {
            throw new StrutsException("Cannot init OSGi platform!", e);
        }
    }
View Full Code Here

    public void contextDestroyed(ServletContextEvent sce) {
        try {
            osgiHost.destroy();
        } catch (Exception e) {
            throw new StrutsException("Cannot stop OSGi platform!", e);
        }
    }
View Full Code Here

                try {
                    // Retry render
                    engine.renderTemplate(templateContext);
                } catch (Exception e) {
                    // Give up and throw a new StrutsException(e);
                    throw new StrutsException("Cannot render tag [" + t.getName() + "] because theme ["
                            + t.getTheme() + "] was not found.", e);
                }
            }
        } else {
            // Render our template
View Full Code Here

                } finally {
                    facesContext.release();
                }
            }
        } else {
            throw new StrutsException(
                    "Unable to initialize jsf interceptors probably due missing JSF implementation libraries",
                    invocation.getProxy().getConfig());
        }
        return invocation.invoke();
    }
View Full Code Here

                // nothing to decorate
                try {
                    current = implClass.newInstance();
                } catch (InstantiationException e) {
                    log.error(e.getMessage(), e);
                    throw new StrutsException(e);
                } catch (IllegalAccessException e) {
                    log.error(e.getMessage(), e);
                    throw new StrutsException(e);
                }
            } else {
                // let's check if class supports the decorator pattern
                try {
                    Constructor delegationConstructor = implClass
                            .getConstructor(new Class[] { interfaceClass });
                    // impl class supports decorator pattern,
                    try {
                        // create new decorator wrapping current
                        current = delegationConstructor
                                .newInstance(new Object[] { current });
                    } catch (InstantiationException e) {
                        log.error(e.getMessage(), e);
                        throw new StrutsException(e);
                    } catch (IllegalAccessException e) {
                        log.error(e.getMessage(), e);
                        throw new StrutsException(e);
                    } catch (InvocationTargetException e) {
                        log.error(e.getMessage(), e);
                        throw new StrutsException(e);
                    }
                } catch (NoSuchMethodException e) {
                    // no decorator pattern support
                    try {
                        current = implClass.newInstance();
                    } catch (InstantiationException e1) {
                        log.error(e.getMessage(), e);
                        throw new StrutsException(e);
                    } catch (IllegalAccessException e1) {
                        log.error(e.getMessage(), e);
                        throw new StrutsException(e);
                    }
                }
            }
        }
View Full Code Here

        }

        List<TagHandler> handlers = new ArrayList<TagHandler>();
        List<TagHandlerFactory> factories = handlerFactories.get(tagName);
        if (factories == null) {
            throw new StrutsException("Unable to find handlers for tag " + tagName);
        }

        TagHandler prev = null;
        for (int x = factories.size() - 1; x >= 0; x--) {
            prev = factories.get(x).create(prev);
            prev.setup(context);
            handlers.add(0, prev);
        }

        // TagSerializer ser = (TagSerializer) handlers.get(handlers.size() - 1);

        TagGenerator gen = (TagGenerator) handlers.get(0);
        try {
            if (LOG.isTraceEnabled())
                LOG.trace("Rendering tag [#0]", tagName);
            gen.generate();
        } catch (IOException ex) {
            throw new StrutsException("Unable to write tag: " + tagName);
        }
    }
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.