Package org.apache.tomcat.util.http.fileupload

Examples of org.apache.tomcat.util.http.fileupload.FileItem


        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here


        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

            Iterator iter = items.iterator();



            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();

                if (item.isFormField()) {
                    //если принимаемая часть данных является полем формы           
                    //if (item.getString("username") != null && !item.getString().equals("password") &&item.getString("password") != null && !item.getString("password").equals("")) {
                    if (item.getFieldName().equals("username")) {
                        if (item.getString() != null && !item.getString().equals("")) {
                            processUsernameField(item, u);

                        } else {
                            request.setAttribute("message", "Login shouldn't be empty!");
                            final RequestDispatcher rd = getServletContext().getRequestDispatcher("/signup.jsp");
                            rd.forward(request, response);
                            return;
                        }
                    } else if (item.getFieldName().equals("password")) {
                        if (item.getString() != null && !item.getString().equals("")) {
                            processPasswordField(item, u);

                        } else {
                            request.setAttribute("message", "Password shouldn't be empty!");
                            final RequestDispatcher rd = getServletContext().getRequestDispatcher("/signup.jsp");
                            rd.forward(request, response);
                            return;
                        }
                    }
                } else {
                    //в противном случае рассматриваем как файл
                    if (!item.getName().contains(".jpg") && !item.getName().contains(".png") && !item.getName().contains(".bmp") && !item.getName().contains(".jpeg")) {
                        request.setAttribute("message", "Only .png, .jpg, .jpeg, .bmp. files allowed!");
                        final RequestDispatcher rd = getServletContext().getRequestDispatcher("/signup.jsp");
                        rd.forward(request, response);
                        return;
                    } else if (item.getName() != "") {
                        processUploadedFile(item, u);

                    } else {
                        request.setAttribute("message", "No file selected!");
View Full Code Here

            Iterator iter = items.iterator();



            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();

                if (item.isFormField()) {
                    //если принимаемая часть данных является полем формы           
                    if (item.getString() != null && !item.getString().equals("")) {
                        processFormField(item, p);

                    } else {
                        request.setAttribute("message", "Title shouldn't be empty!");
                        final RequestDispatcher rd = getServletContext().getRequestDispatcher("/protected/addpost.jsp");
                        rd.forward(request, response);
                        return;
                    }
                } else {
                    //в противном случае рассматриваем как файл
                    if (!item.getName().contains(".jpg") && !item.getName().contains(".png") && !item.getName().contains(".bmp") && !item.getName().contains(".jpeg")) {
                        request.setAttribute("message", "Only .png, .jpg, .jpeg, .bmp. files allowed!");
                        final RequestDispatcher rd = getServletContext().getRequestDispatcher("/protected/addpost.jsp");
                        rd.forward(request, response);
                        return;
                    } else if (item.getName() != "") {
                        processUploadedFile(item, p);

                    } else {
                        request.setAttribute("message", "No file selected!");
View Full Code Here

        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
       
                if (!item.isFormField()) {
                    if (item.getFieldName().equals("deployWar") &&
                        warUpload == null) {
                        warUpload = item;
                    } else {
                        item.delete();
                    }
                }
            }
            while (true) {
                if (warUpload == null) {
View Full Code Here

TOP

Related Classes of org.apache.tomcat.util.http.fileupload.FileItem

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.