Package org.g4studio.core.mvc.xstruts.upload

Examples of org.g4studio.core.mvc.xstruts.upload.MultipartRequestHandler


    if (bean instanceof ActionForm) {
      ((ActionForm) bean).setMultipartRequestHandler(null);
    }

    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.g4studio.core.mvc.xstruts.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
        Boolean maxLengthExceeded = (Boolean) request
            .getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
View Full Code Here


   * @throws ServletException
   *             if any exception is thrown while attempting to locate the
   *             multipart handler.
   */
  private static MultipartRequestHandler getMultipartHandler(HttpServletRequest request) throws ServletException {
    MultipartRequestHandler multipartHandler = null;
    String multipartClass = (String) request.getAttribute(Globals.MULTIPART_KEY);

    request.removeAttribute(Globals.MULTIPART_KEY);

    // Try to initialize the mapping specific request handler
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.upload.MultipartRequestHandler

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.