Package org.apache.struts.action

Examples of org.apache.struts.action.ActionServlet


    {
        //
        // Ensure that the right Struts module is selected, for use by the tags.
        //
        String curModulePath = PageFlowUtils.getModulePath( request );
        ActionServlet as = InternalUtils.getActionServlet( _servletContext );
               
        if ( as instanceof AutoRegisterActionServlet )
        {
            AutoRegisterActionServlet das = ( AutoRegisterActionServlet ) as;
            das.ensureModuleRegistered( curModulePath, request );
View Full Code Here


        if ( scopedResponse == null )
        {
            throw new IllegalArgumentException( "response must be of type " + ScopedResponse.class.getName() );
        }
       
        ActionServlet as = InternalUtils.getActionServlet( context );
       
        if ( as == null )
        {
            _log.error( "There is no initialized ActionServlet.  The ActionServlet must be set to load-on-startup." );
            return null;
        }
       
        if ( actionOverride != null )
        {
            // The action must be fully-qualified with its module path.
            assert actionOverride.charAt( 0 ) == '/' : actionOverride;
            InternalStringBuilder uri = new InternalStringBuilder( scopedRequest.getContextPath() );
            uri.append( actionOverride );
            uri.append( PageFlowConstants.ACTION_EXTENSION );
            scopedRequest.setRequestURI( uri.toString() );
        }

        //
        // In case the request was already forwarded once, clear out the recorded forwarded-URI.  This
        // will allow us to tell whether processing the request actually forwarded somewhere.
        //
        scopedRequest.setForwardedURI( null );
       
        //
        // Now process the request.  We create a PageFlowRequestWrapper for pageflow-specific request-scoped info.
        //
        PageFlowRequestWrapper wrappedRequest = PageFlowRequestWrapper.wrapRequest( ( HttpServletRequest ) request );
        as.doGet( wrappedRequest, scopedResponse )// this just calls process() -- same as doPost()

        String returnURI;

        if ( ! scopedResponse.didRedirect() )
        {
View Full Code Here

    {
        ModuleConfig mc = InternalUtils.getModuleConfig( modulePath, servletContext );       
       
        if ( mc == null )
        {
            ActionServlet as = InternalUtils.getActionServlet( servletContext );
               
            if ( as instanceof AutoRegisterActionServlet )
            {
                AutoRegisterActionServlet das = ( AutoRegisterActionServlet ) as;
               
View Full Code Here

            isMultipart = true;
            //initialize a MultipartRequestHandler
            MultipartRequestHandler multipart = null;

            //get an instance of ActionServlet
            ActionServlet servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServlet();
            } else {
                throw new ServletException("bean that's supposed to be " +
                                           "populated from a multipart request is not of type " +
                                           "\"org.apache.struts.action.ActionForm\", but type " +
                                           "\"" + bean.getClass().getName() + "\"");
            }
            String multipartClass = (String)
                request.getAttribute(Action.MULTIPART_KEY);
            request.removeAttribute(Action.MULTIPART_KEY);

            if (multipartClass != null) {
                //try to initialize the mapping specific request handler
                try {
                    multipart = (MultipartRequestHandler) Class.forName(multipartClass).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    servlet.log("MultipartRequestHandler class \"" +
                    multipartClass + "\" in mapping class not found, " +
                    "defaulting to global multipart class");
                }
                catch (InstantiationException ie) {
                    servlet.log("InstantiaionException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    servlet.log("IllegalAccessException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    iae.getMessage());
                }
            }

            if (multipart == null) {
                //try to initialize the global multipart class
                try {
                    multipart = (MultipartRequestHandler) Class.forName(servlet.getMultipartClass()).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    throw new ServletException("Cannot find multipart class \"" +
                    servlet.getMultipartClass() + "\"" +
                    ", exception: " + cnfe.getMessage());
                }
                catch (InstantiationException ie) {
                    throw new ServletException("InstantiaionException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    throw new ServletException("IllegalAccessException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + iae.getMessage());
                }
            }

View Full Code Here

            isMultipart = true;
            //initialize a MultipartRequestHandler
            MultipartRequestHandler multipart = null;

            //get an instance of ActionServlet
            ActionServlet servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServlet();
            } else {
                throw new ServletException("bean that's supposed to be " +
                                           "populated from a multipart request is not of type " +
                                           "\"org.apache.struts.action.ActionForm\", but type " +
                                           "\"" + bean.getClass().getName() + "\"");
            }
            String multipartClass = (String)
                request.getAttribute(Action.MULTIPART_KEY);
            request.removeAttribute(Action.MULTIPART_KEY);

            if (multipartClass != null) {
                //try to initialize the mapping specific request handler
                try {
                    multipart = (MultipartRequestHandler) Class.forName(multipartClass).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    servlet.log("MultipartRequestHandler class \"" +
                    multipartClass + "\" in mapping class not found, " +
                    "defaulting to global multipart class");
                }
                catch (InstantiationException ie) {
                    servlet.log("InstantiaionException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    servlet.log("IllegalAccessException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    iae.getMessage());
                }
            }

            if (multipart == null) {
                //try to initialize the global multipart class
                try {
                    multipart = (MultipartRequestHandler) Class.forName(servlet.getMultipartClass()).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    throw new ServletException("Cannot find multipart class \"" +
                    servlet.getMultipartClass() + "\"" +
                    ", exception: " + cnfe.getMessage());
                }
                catch (InstantiationException ie) {
                    throw new ServletException("InstantiaionException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    throw new ServletException("IllegalAccessException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + iae.getMessage());
                }
            }

View Full Code Here

            isMultipart = true;
            //initialize a MultipartRequestHandler
            MultipartRequestHandler multipart = null;

            //get an instance of ActionServlet
            ActionServlet servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServlet();
            } else {
                throw new ServletException("bean that's supposed to be " +
                                           "populated from a multipart request is not of type " +
                                           "\"org.apache.struts.action.ActionForm\", but type " +
                                           "\"" + bean.getClass().getName() + "\"");
            }
            String multipartClass = (String)
                request.getAttribute(Action.MULTIPART_KEY);
            request.removeAttribute(Action.MULTIPART_KEY);

            if (multipartClass != null) {
                //try to initialize the mapping specific request handler
                try {
                    multipart = (MultipartRequestHandler) Class.forName(multipartClass).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    servlet.log("MultipartRequestHandler class \"" +
                    multipartClass + "\" in mapping class not found, " +
                    "defaulting to global multipart class");
                }
                catch (InstantiationException ie) {
                    servlet.log("InstantiaionException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    servlet.log("IllegalAccessException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    iae.getMessage());
                }
            }

            if (multipart == null) {
                //try to initialize the global multipart class
                try {
                    multipart = (MultipartRequestHandler) Class.forName(servlet.getMultipartClass()).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    throw new ServletException("Cannot find multipart class \"" +
                    servlet.getMultipartClass() + "\"" +
                    ", exception: " + cnfe.getMessage());
                }
                catch (InstantiationException ie) {
                    throw new ServletException("InstantiaionException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    throw new ServletException("IllegalAccessException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + iae.getMessage());
                }
            }

View Full Code Here

            isMultipart = true;
            //initialize a MultipartRequestHandler
            MultipartRequestHandler multipart = null;

            //get an instance of ActionServlet
            ActionServlet servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServlet();
            } else {
                throw new ServletException("bean that's supposed to be " +
                                           "populated from a multipart request is not of type " +
                                           "\"org.apache.struts.action.ActionForm\", but type " +
                                           "\"" + bean.getClass().getName() + "\"");
            }
            String multipartClass = (String)
                request.getAttribute(Action.MULTIPART_KEY);
            request.removeAttribute(Action.MULTIPART_KEY);

            if (multipartClass != null) {
                //try to initialize the mapping specific request handler
                try {
                    multipart = (MultipartRequestHandler) Class.forName(multipartClass).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    servlet.log("MultipartRequestHandler class \"" +
                    multipartClass + "\" in mapping class not found, " +
                    "defaulting to global multipart class");
                }
                catch (InstantiationException ie) {
                    servlet.log("InstantiaionException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    servlet.log("IllegalAccessException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    iae.getMessage());
                }
            }

            if (multipart == null) {
                //try to initialize the global multipart class
                try {
                    multipart = (MultipartRequestHandler) Class.forName(servlet.getMultipartClass()).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    throw new ServletException("Cannot find multipart class \"" +
                    servlet.getMultipartClass() + "\"" +
                    ", exception: " + cnfe.getMessage());
                }
                catch (InstantiationException ie) {
                    throw new ServletException("InstantiaionException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    throw new ServletException("IllegalAccessException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + iae.getMessage());
                }
            }

View Full Code Here

            isMultipart = true;
            //initialize a MultipartRequestHandler
            MultipartRequestHandler multipart = null;

            //get an instance of ActionServlet
            ActionServlet servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServlet();
            } else {
                throw new ServletException("bean that's supposed to be " +
                                           "populated from a multipart request is not of type " +
                                           "\"org.apache.struts.action.ActionForm\", but type " +
                                           "\"" + bean.getClass().getName() + "\"");
            }
            String multipartClass = (String)
                request.getAttribute(Action.MULTIPART_KEY);
            request.removeAttribute(Action.MULTIPART_KEY);

            if (multipartClass != null) {
                //try to initialize the mapping specific request handler
                try {
                    multipart = (MultipartRequestHandler) Class.forName(multipartClass).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    servlet.log("MultipartRequestHandler class \"" +
                    multipartClass + "\" in mapping class not found, " +
                    "defaulting to global multipart class");
                }
                catch (InstantiationException ie) {
                    servlet.log("InstantiaionException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    servlet.log("IllegalAccessException when instantiating " +
                    "MultipartRequestHandler \"" + multipartClass + "\", " +
                    "defaulting to global multipart class, exception: " +
                    iae.getMessage());
                }
            }

            if (multipart == null) {
                //try to initialize the global multipart class
                try {
                    multipart = (MultipartRequestHandler) Class.forName(servlet.getMultipartClass()).newInstance();
                }
                catch (ClassNotFoundException cnfe) {
                    throw new ServletException("Cannot find multipart class \"" +
                    servlet.getMultipartClass() + "\"" +
                    ", exception: " + cnfe.getMessage());
                }
                catch (InstantiationException ie) {
                    throw new ServletException("InstantiaionException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + ie.getMessage());
                }
                catch (IllegalAccessException iae) {
                    throw new ServletException("IllegalAccessException when instantiating " +
                    "multipart class \"" + servlet.getMultipartClass() +
                    "\", exception: " + iae.getMessage());
                }
            }

View Full Code Here

        initparams.put("config/upload", "/WEB-INF/upload/struts-config.xml");
        initparams.put("config/validator", "/WEB-INF/validator/struts-config.xml");
        initparams.put("config/dispatch", "/WEB-INF/dispatch/struts-config.xml");
        initparams.put("debug", "2");
        initparams.put("detail", "2");
        Servlet adaptedActionServlet = new ContextPathServletAdaptor(new ActionServlet(), "/struts-examples");
        httpService.registerServlet("/struts-examples/*.do", adaptedActionServlet, initparams, commonContext);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
View Full Code Here

                req.setAttribute(Globals.MESSAGES_KEY, new WrapperMessageResources((TextProvider)invocation.getAction()));
               
                mapping.setAttribute(modelDriven.getScopeKey());
               
                ActionForm form = (ActionForm) model;
                form.setServlet(new ActionServlet(){
                    public ServletContext getServletContext() {
                        return ServletActionContext.getServletContext();
                    }
                });
                ActionErrors errors = form.validate(mapping, req);
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionServlet

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.