Package org.apache.struts.action

Examples of org.apache.struts.action.ActionServletWrapper


            if ( ! InternalUtils.isMultipartHandlingEnabled( request ) )
            {
                throw new ServletException( "Received a multipart request, but multipart handling is not enabled." );
            }
           
            ActionServletWrapper servlet;
           
            if (bean != null)
            {
                servlet = bean.getServletWrapper();
            }
            else
            {
                ServletContext servletContext = InternalUtils.getServletContext(request);
                servlet = new ActionServletWrapper(InternalUtils.getActionServlet(servletContext));
            }
           
            // @struts: does this -- but we can't rely on the bean not being null.
            // if(bean instanceof ActionForm)
            //     servlet = bean.getServletWrapper();
            // else if ( ! ( bean instanceof ActionForm ) )
            //     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() + "\"");
           
            MultipartRequestHandler multipartHandler = getCachedMultipartHandler(request);
            boolean preHandled = false;
           
            if (multipartHandler == null)
            {
                multipartHandler = getMultipartHandler(request);
            }
            else
            {
                preHandled = true;
            }
           
            if (bean != null)
            {
                bean.setMultipartRequestHandler(multipartHandler);
            }
           
            if(multipartHandler != null)
            {
                isMultipart = true;
               
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping((ActionMapping)request.getAttribute(Globals.MAPPING_KEY));
               
                if (! preHandled)
                {
                    multipartHandler.handleRequest(request);
View Full Code Here


        if ((contentType != null)
            && (contentType.startsWith("multipart/form-data"))
            && (method.equalsIgnoreCase("POST"))) {

            // Get the ActionServletWrapper from the form bean
            ActionServletWrapper servlet;
            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServletWrapper();
            } 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()
                        + "\"");
            }

            // Obtain a MultipartRequestHandler
            MultipartRequestHandler multipartHandler = getMultipartHandler(request);

            // Set the multipart request handler for our ActionForm.
            // If the bean isn't an ActionForm, an exception would have been
            // thrown earlier, so it's safe to assume that our bean is
            // in fact an ActionForm.
             ((ActionForm) bean).setMultipartRequestHandler(multipartHandler);

            if (multipartHandler != null) {
                isMultipart = true;
                // Set servlet and mapping info
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping(
                    (ActionMapping) request.getAttribute(Globals.MAPPING_KEY));
                // Initialize multipart request class handler
                multipartHandler.handleRequest(request);
                //stop here if the maximum length has been exceeded
View Full Code Here

        if ((contentType != null)
                && (contentType.startsWith("multipart/form-data"))
                && (method.equalsIgnoreCase("POST"))) {

            // Get the ActionServletWrapper from the form bean
            ActionServletWrapper servlet;
            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServletWrapper();
            } 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()
                        + "\"");
            }

            // Obtain a MultipartRequestHandler
            MultipartRequestHandler multipartHandler = getMultipartHandler(request);

            // Set the multipart request handler for our ActionForm.
            // If the bean isn't an ActionForm, an exception would have been
            // thrown earlier, so it's safe to assume that our bean is
            // in fact an ActionForm.
            ((ActionForm) bean).setMultipartRequestHandler(multipartHandler);

            if (multipartHandler != null) {
                isMultipart = true;
                // Set servlet and mapping info
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping(
                        (ActionMapping) request.getAttribute(Globals.MAPPING_KEY));
                // Initialize multipart request class handler
                multipartHandler.handleRequest(request);
                //stop here if the maximum length has been exceeded
View Full Code Here

            if ( ! InternalUtils.isMultipartHandlingEnabled( request ) )
            {
                throw new ServletException( "Received a multipart request, but multipart handling is not enabled." );
            }
           
            ActionServletWrapper servlet;
           
            if (bean != null)
            {
                servlet = bean.getServletWrapper();
            }
            else
            {
                ServletContext servletContext = InternalUtils.getServletContext(request);
                servlet = new ActionServletWrapper(InternalUtils.getActionServlet(servletContext));
            }
           
            // @struts: does this -- but we can't rely on the bean not being null.
            // if(bean instanceof ActionForm)
            //     servlet = bean.getServletWrapper();
            // else if ( ! ( bean instanceof ActionForm ) )
            //     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() + "\"");
           
            MultipartRequestHandler multipartHandler = getCachedMultipartHandler(request);
            boolean preHandled = false;
           
            if (multipartHandler == null)
            {
                multipartHandler = getMultipartHandler(request);
            }
            else
            {
                preHandled = true;
            }
           
            if (bean != null)
            {
                bean.setMultipartRequestHandler(multipartHandler);
            }
           
            if(multipartHandler != null)
            {
                isMultipart = true;
               
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping((ActionMapping)request.getAttribute(Globals.MAPPING_KEY));
               
                if (! preHandled)
                {
                    multipartHandler.handleRequest(request);
View Full Code Here

        if ((contentType != null)
                && (contentType.startsWith("multipart/form-data"))
                && (method.equalsIgnoreCase("POST"))) {

            // Get the ActionServletWrapper from the form bean
            ActionServletWrapper servlet;
            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServletWrapper();
            } 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()
                        + "\"");
            }

            // Obtain a MultipartRequestHandler
            multipartHandler = getMultipartHandler(request);

            if (multipartHandler != null) {
                isMultipart = true;
                // Set servlet and mapping info
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping(
                        (ActionMapping) request.getAttribute(Globals.MAPPING_KEY));
                // Initialize multipart request class handler
                multipartHandler.handleRequest(request);
                //stop here if the maximum length has been exceeded
View Full Code Here

        if ((contentType != null)
            && (contentType.startsWith("multipart/form-data"))
            && (method.equalsIgnoreCase("POST"))) {

            // Get the ActionServletWrapper from the form bean
            ActionServletWrapper servlet;
            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServletWrapper();
            } 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()
                        + "\"");
            }

            // Obtain a MultipartRequestHandler
            MultipartRequestHandler multipartHandler = getMultipartHandler(request);

            // Set the multipart request handler for our ActionForm.
            // If the bean isn't an ActionForm, an exception would have been
            // thrown earlier, so it's safe to assume that our bean is
            // in fact an ActionForm.
             ((ActionForm) bean).setMultipartRequestHandler(multipartHandler);

            if (multipartHandler != null) {
                isMultipart = true;
                // Set servlet and mapping info
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping(
                    (ActionMapping) request.getAttribute(Globals.MAPPING_KEY));
                // Initialize multipart request class handler
                multipartHandler.handleRequest(request);
                //stop here if the maximum length has been exceeded
View Full Code Here

        MultipartRequestHandler multipartHandler = null;
        if ((contentType != null)
            && (contentType.startsWith("multipart/form-data"))
            && (method.equalsIgnoreCase("POST"))) {
            // Get the ActionServletWrapper from the form bean
            ActionServletWrapper servlet;

            if (bean instanceof ActionForm) {
                servlet = ((ActionForm) bean).getServletWrapper();
            } 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() + "\"");
            }

            // Obtain a MultipartRequestHandler
            multipartHandler = getMultipartHandler(request);

            if (multipartHandler != null) {
                isMultipart = true;

                // Set servlet and mapping info
                servlet.setServletFor(multipartHandler);
                multipartHandler.setMapping((ActionMapping) request
                    .getAttribute(Globals.MAPPING_KEY));

                // Initialize multipart request class handler
                multipartHandler.handleRequest(request);
View Full Code Here

TOP

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

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.