Symantec IGA

 View Only
  • 1.  [IM] Sending file to IM using JSP

    Posted Jan 26, 2017 05:15 AM

    Hi,

    I create a admin task with a JSP screen.

    The JSP is a very basic form with several inputs among them an input type="file", i set the enctype of the form to "multipart/form-data" using Javascript then i send data to the same JSP task.

    But i can't recuperate my file, cause the request  received has an enctype="application/x-www-form-urlencoded". When i check the request sent using firefox and wireshark, the enctype="multipart/form-data", So i think that IM modifies the enctype when it recieve the request.

    My question is: can i send files from a task type=JSP in IM?

     

    i can't create my task using the standard IM screen cause i use alot of custom code to fill the inputs

     

    Best regard.



  • 2.  Re: [IM] Sending file to IM using JSP

    Posted Jan 26, 2017 04:37 PM

    Hello Amine,

     

    What do you intend to do with sending a file to a jsp?  Are you making the modifications through the jsp file or the web ui and adding the javascript? Based on enctype="multipart/form-data", this parameter looks okay. If this product is integrated with Siteminder, this is a good article to look at:

     

    https://www.ca.com/us/services-support/ca-support/ca-support-online/knowledge-base-articles.tec486206.html 

     

    Instead of using the enctype="multipart/form-data", what happens if you use "enctype="application/x-www-form-urlencoded" instead since this is what the request returns?

     

    Thank you,

    Andrew Nguyen

     

     



  • 3.  Re: [IM] Sending file to IM using JSP

    Posted Jan 27, 2017 05:46 AM

    Hello Andrew,

    Thank you for your answer.


    By sending file to a jsp, i wanted say uploading files. I  set the enctype to "multipart/form-data" using javascript before i submit the form cause by default the enctype="application/x-www-form-urlencoded" and i can't use the enctype="application/x-www-form-urlencoded", cause to upload  files, i have to parse the requste(in the jsp) using "upload.parseRequest(request)" (you can find the snippet below) and this function return this exception "org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null" when enctype="multipart/form-data" are not equal to , the code work well before the integration on IM (using the task in jsp).

     

    Yes we use the SiteMinder on the production environement but not in the developpement environement, actually we have this issue in the developpement environement.

     

    My question is:

    Is it impossible to use another enctype instead "application/x-www-form-urlencoded"?

     

    FileItemFactory factory = new DiskFileItemFactory();
    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);
    try {
        // Here i get the exception
        List items = upload.parseRequest(request);
        Iterator iterator = items.iterator();
        while (iterator.hasNext()) {
            FileItem item = (FileItem) iterator.next();
            if (!item.isFormField()) {
                String fileName = item.getName();    
                String root = getServletContext().getRealPath("/");
                File path = new File(root + "/uploads");
                if (!path.exists()) {
                    boolean status = path.mkdirs();
                }
                File uploadedFile = new File(path + "/" + fileName);
                System.out.println(uploadedFile.getAbsolutePath());
                item.write(uploadedFile);
            }
        }
    } catch (FileUploadException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

     


    Best regards.



  • 4.  Re: [IM] Sending file to IM using JSP

    Broadcom Employee
    Posted Jan 27, 2017 08:50 AM

    Please consult CA Services or open a Support case.  While such customization is typically out of scope of Support, we could investigate the possible encoding that is supported.