Package com.meterware.httpunit.protocol

Examples of com.meterware.httpunit.protocol.UploadFileSpec


        request.setParameter("myparam", new String[] { "hello",
                "中华人民共和国" });

        try {
            request.setParameter("myfile", new UploadFileSpec[] { //
                    new UploadFileSpec(new File(srcdir, "smallfile.txt")), //
                            new UploadFileSpec(new File(srcdir, "smallfile_.JPG")), //
                            new UploadFileSpec(new File(srcdir, "smallfile.gif")), //
                            new UploadFileSpec(new File(srcdir, "smallfile")), //
                    });
        } catch (IllegalRequestParameterException e) {
        }

        client.putCookie("mycookie", "mycookievalue");
View Full Code Here


                    File[] files = value instanceof File ? new File[] { (File) value } : (File[]) value;
                    UploadFileSpec[] specs = new UploadFileSpec[files.length];

                    for (int i = 0; i < files.length; i++) {
                        if (files[i].getName().contains(".")) {
                            specs[i] = new UploadFileSpec(files[i]);
                        } else {
                            specs[i] = new UploadFileSpec(files[i], ""); // 对于无后缀的文件,不设contentType
                        }
                    }

                    wr.setParameter(name, specs);
                } else {
View Full Code Here

                post.selectFile(key, (File) value);
            } else if (value instanceof File[]) {
                UploadFileSpec[] specs = new UploadFileSpec[((File[]) value).length];

                for (int j = 0; j < ((File[]) value).length; j++) {
                    specs[j] = new UploadFileSpec(((File[]) value)[j]);
                }

                post.setParameter(key, specs);
            } else {
                post.setParameter(key, (String) value);
View Full Code Here

        request.setParameter("myparam", new String[] { "hello",
                                                       "&#20013;&#21326;&#20154;&#27665;&#20849;&#21644;&#22269;" });

        try {
            request.setParameter("myfile", new UploadFileSpec[] { //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile.txt")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile_.JPG")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile.gif")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile")), //
            });
        } catch (IllegalRequestParameterException e) {
        }

        client.putCookie("mycookie", "mycookievalue");
View Full Code Here

        request.setParameter("myparam", new String[] { "hello",
                                                       "&#20013;&#21326;&#20154;&#27665;&#20849;&#21644;&#22269;" });

        try {
            request.setParameter("myfile", new UploadFileSpec[] { //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile.txt")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile_.JPG")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile.gif")), //
                                                                  new UploadFileSpec(new File(srcdir, "smallfile")), //
            });
        } catch (IllegalRequestParameterException e) {
        }

        client.putCookie("mycookie", "mycookievalue");
View Full Code Here

                post.selectFile(key, (File) value);
            } else if (value instanceof File[]) {
                UploadFileSpec[] specs = new UploadFileSpec[((File[]) value).length];

                for (int j = 0; j < ((File[]) value).length; j++) {
                    specs[j] = new UploadFileSpec(((File[]) value)[j]);
                }

                post.setParameter(key, specs);
            } else {
                post.setParameter(key, (String) value);
View Full Code Here

                    File[] files = value instanceof File ? new File[] { (File) value } : (File[]) value;
                    UploadFileSpec[] specs = new UploadFileSpec[files.length];

                    for (int i = 0; i < files.length; i++) {
                        if (files[i].getName().contains(".")) {
                            specs[i] = new UploadFileSpec(files[i]);
                        } else {
                            specs[i] = new UploadFileSpec(files[i], ""); // 对于无后缀的文件,不设contentType
                        }
                    }

                    wr.setParameter(name, specs);
                } else {
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.protocol.UploadFileSpec

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.