Package org.apache.commons.fileupload.disk

Examples of org.apache.commons.fileupload.disk.DiskFileItemFactory


            LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
            Delegator delegator = (Delegator) request.getAttribute("delegator");
            HttpSession session = request.getSession();
            GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");

            ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
            List<FileItem> lst = null;
            try {
                lst = UtilGenerics.checkList(dfu.parseRequest(request));
            } catch (FileUploadException e4) {
                request.setAttribute("_ERROR_MESSAGE_", e4.getMessage());
View Full Code Here


    public static String uploadContentStuff(HttpServletRequest request, HttpServletResponse response) {
        try {
            HttpSession session = request.getSession();
            GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");

            ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
            //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]DiskFileUpload " + dfu, module);
            List<FileItem> lst = null;
            try {
                lst = UtilGenerics.checkList(dfu.parseRequest(request));
            } catch (FileUploadException e4) {
View Full Code Here

    // TODO: This method is not used and should be removed. amb
    public static String uploadAndStoreImage(HttpServletRequest request, String idField, String uploadField) {
        //Delegator delegator = (Delegator) request.getAttribute("delegator");

        //String idFieldValue = null;
        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        Locale locale = UtilHttp.getLocale(request);

        try {
            lst = UtilGenerics.checkList(fu.parseRequest(request));
View Full Code Here

            String fileType = null;
            String artifact = null;
            String version = null;
            String group = null;

            PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
            try {
                List items = uploader.parseRequest(actionRequest);
                for (Iterator i = items.iterator(); i.hasNext();) {
                    FileItem item = (FileItem) i.next();
                    if (!item.isFormField()) {
View Full Code Here

     *
     * @throws Exception
     */
    public void testAddPathInfo() throws Exception
    {
        FileItemFactory factory = new DiskFileItemFactory(10240, null);

        assertEquals("keySet() is not empty!", 0, parameterParser.keySet().size());

        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
        // Push this into the parser using DefaultParameterParser's add() method.
        ((DefaultParameterParser) parameterParser).add("upload-field", test);

        assertEquals("FileItem not found in keySet()!", 1, parameterParser.keySet().size());

View Full Code Here

        String encoding = request.getCharacterEncoding();
        // check for multipart content types which may have uploaded items
        boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
        Map<String, Object> multiPartMap = FastMap.newInstance();
        if (isMultiPart) {
            ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, new File(tmpUploadRepository)));

            // create the progress listener and add it to the session
            FileUploadProgressListener listener = new FileUploadProgressListener();
            upload.setProgressListener(listener);
            session.setAttribute("uploadProgressListener", listener);
View Full Code Here

        response.setRenderParameter("importSource", type);
        if (!PortletFileUpload.isMultipartContent(request)) {
            throw new PortletException("Expected file upload");
        }

        PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
        try {
            List items = uploader.parseRequest(request);
            for (Iterator i = items.iterator(); i.hasNext();) {
                FileItem item = (FileItem) i.next();
                if (!item.isFormField()) {
View Full Code Here

        response.setRenderParameter("importSource", type);
        if (!PortletFileUpload.isMultipartContent(request)) {
            throw new PortletException("Expected file upload");
        }

        PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
        try {
            List<FileItem> items = uploader.parseRequest(request);
            for (FileItem item : items) {
                if (!item.isFormField()) {
                    File file = File.createTempFile("geronimo-import", "");
View Full Code Here

        Map files = null;
        Map fields = null;
        if(actionRequest.getContentType() != null && actionRequest.getContentType().startsWith("multipart/form-data")) {
            files = new HashMap();
            fields = new HashMap();
            PortletFileUpload request = new PortletFileUpload(new DiskFileItemFactory());
            try {
                List items = request.parseRequest(actionRequest);
                for (int i = 0; i < items.size(); i++) {
                    FileItem item = (FileItem) items.get(i);
                    if(item.isFormField()) {
View Full Code Here

        response.setRenderParameter("importSource", type);
        if (!PortletFileUpload.isMultipartContent(request)) {
            throw new PortletException("Expected file upload");
        }

        PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
        try {
            List items = uploader.parseRequest(request);
            for (Iterator i = items.iterator(); i.hasNext();) {
                FileItem item = (FileItem) i.next();
                if (!item.isFormField()) {
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.disk.DiskFileItemFactory

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.