Package org.slim3.controller.upload

Examples of org.slim3.controller.upload.FileUpload$FileItemIteratorImpl


                + path
                + ") must start with \"/\".");
        }
        request
            .setAttribute(ControllerConstants.FORWARD_SERVLET_PATH_KEY, path);
        Router router = RouterFactory.getRouter();
        String routingPath = router.route(request, path);
        if (routingPath != null) {
            int index = routingPath.lastIndexOf('?');
            if (index < 0) {
                path = routingPath;
            } else {
View Full Code Here


    }

    @Override
    public void handle() {
        try {
            FileUpload upload = createFileUpload();
            FileItemIterator iter = upload.getItemIterator(request);
            while (iter.hasNext()) {
                FileItemStream item = iter.next();
                String name = item.getFieldName();
                InputStream stream = item.openStream();
                if (item.isFormField()) {
View Full Code Here

     * Creates a {@link FileUpload}.
     *
     * @return a {@link FileUpload}
     */
    protected FileUpload createFileUpload() {
        FileUpload upload = new FileUpload();
        upload.setHeaderEncoding(request.getCharacterEncoding());
        String sizeMax = System.getProperty(SIZE_MAX_KEY);
        if (!StringUtil.isEmpty(sizeMax)) {
            upload.setSizeMax(Long.valueOf(sizeMax));
        }
        String fileSizeMax = System.getProperty(FILE_SIZE_MAX_KEY);
        if (!StringUtil.isEmpty(fileSizeMax)) {
            upload.setFileSizeMax(Long.valueOf(fileSizeMax));
        }
        return upload;
    }
View Full Code Here

    @Test
    public void createFileUploadForEncoding() throws Exception {
        String encoding = "UTF-8";
        request.setCharacterEncoding(encoding);
        MultipartRequestHandler handler = new MultipartRequestHandler(request);
        FileUpload upload = handler.createFileUpload();
        assertThat(upload.getHeaderEncoding(), is(encoding));
    }
View Full Code Here

    public void createFileUploadForSizeMax() throws Exception {
        long sizeMax = 1000;
        System.setProperty(MultipartRequestHandler.SIZE_MAX_KEY, String
            .valueOf(sizeMax));
        MultipartRequestHandler handler = new MultipartRequestHandler(request);
        FileUpload upload = handler.createFileUpload();
        assertThat(upload.getSizeMax(), is(sizeMax));
    }
View Full Code Here

    public void createFileUploadForFileSizeMax() throws Exception {
        long fileSizeMax = 100;
        System.setProperty(MultipartRequestHandler.FILE_SIZE_MAX_KEY, String
            .valueOf(fileSizeMax));
        MultipartRequestHandler handler = new MultipartRequestHandler(request);
        FileUpload upload = handler.createFileUpload();
        assertThat(upload.getFileSizeMax(), is(fileSizeMax));
    }
View Full Code Here

        controller.servletContext = servletContext;
        controller.request = request;
        controller.response = response;
        int pos = path.lastIndexOf('/');
        controller.basePath = path.substring(0, pos + 1);
        Errors errors = (Errors) request.getAttribute(ControllerConstants.ERRORS_KEY);
        if (errors == null) {
            errors = new Errors();
            request.setAttribute(ControllerConstants.ERRORS_KEY, errors);
        }
        controller.errors = errors;
        return controller;
    }
View Full Code Here

        }
        return redirect(basePath);
    }
   
    protected boolean validate() {
        Validators v = new Validators(request);
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

        }
        return redirect(basePath);
    }
   
    protected boolean validate () {
        Validators v = new Validators (request);
        v.add(meta.email, v.required());
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

        try {
            if (!validateInsertUser(uid)) {
                // 登録画面を表示
                return forward("/manager/regist.jsp");
            }
            Validators v = getValidator();
            v.add(
                "uid",
                v.required(),
                v.maxlength(VALID_MAX_UID),
                v.minlength(VALID_MIN_UID));
            if (v.validate()) {
                Transaction tx= Datastore.beginTransaction();
                User user =
                    service.put(tx, uid, name, mail, phone, zipcode, address);
                // ユーザ登録メール送信
                if (!sendConfirmationMail(user)) {
View Full Code Here

TOP

Related Classes of org.slim3.controller.upload.FileUpload$FileItemIteratorImpl

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.