Package org.chiba.xml.xforms.exception

Examples of org.chiba.xml.xforms.exception.XFormsException


        Map[] parameters;
        try {
            parameters = parseRequest(request);
        }
        catch (Exception e) {
            throw new XFormsException("could not parse request", e);
        }

        // todo: implement action block behaviour ?
        if (parameters[0] != null) {
            processUploadParameters(parameters[0], request);
View Full Code Here


                item.delete();
            }
        }
        catch (Exception e) {
            throw new XFormsException(e);
        }
    }
View Full Code Here

            try {
                if(this.chibaBean != null){
                    DOMUtil.prettyPrintDOM(this.chibaBean.getXMLContainer(),System.out);
                }
            } catch (TransformerException e) {
                throw new XFormsException(e);
            }
        }

    }
View Full Code Here

            this.chibaBean.updateControlValue(targetId, (String) event.getContextInfo());
        } else if (event.getEventName().equalsIgnoreCase("http-request")) {
            HttpServletRequest request = (HttpServletRequest) event.getContextInfo();
            getHttpRequestHandler().handleRequest(request);
        } else {
            throw new XFormsException("Unknown or illegal event type");
        }
    }
View Full Code Here

                        setXForms(stream);
                    } else {
                        setXForms(new URI(formURI));
                    }
                } catch (URISyntaxException e) {
                    throw new XFormsException("URI not well-formed",e);
                } catch (FileNotFoundException e) {
                    throw new XFormsException("File " + formURI +
                            " not found.", e);
                }
                chibaBean.setBaseURI(baseURI);
            }
View Full Code Here

            List items;
            try {
                items = upload.parseRequest(request);
            } catch (FileUploadException e) {
                throw new XFormsException(e);
            }

            Map formFields = new HashMap();
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
                String itemName = item.getName();
                String fieldName = item.getFieldName();
                String id = fieldName.substring(Config.getInstance().
                            getProperty("chiba.web.dataPrefix").length());

                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Multipart item name is: " + itemName
                            + " and fieldname is: " + fieldName
                            + " and id is: " + id);
                    logger.fine("Is formfield: " + item.isFormField());
                    logger.fine("Content: " + item.getString());
                }

                if (item.isFormField()) {

                    if (removeUploadPrefix == null) {
                        try {
                            removeUploadPrefix = Config.getInstance().
                                    getProperty("chiba.web.removeUploadPrefix",
                                                "ru_");
                        } catch (Exception e) {
                            removeUploadPrefix = "ru_";
                        }
                    }

                    if (fieldName.startsWith(removeUploadPrefix)) {
                        id = fieldName.substring(removeUploadPrefix.length());
                        chibaBean.updateControlValue(id, "", "", null);
                        continue;
                    }

                    // It's a field name, not a file. Do the same
                    // as processUrlencodedRequest
                    String values[] = (String[]) formFields.get(fieldName);
                    String formFieldValue = null;
                    try {
                        formFieldValue = item.getString(encoding);
                    } catch (UnsupportedEncodingException e1) {
                        throw new XFormsException(e1.getMessage(), e1);
                    }

                    if (values == null) {
                        formFields.put(fieldName, new String[]{formFieldValue});
                    } else {
                        String[] tmp = new String[values.length + 1];
                        System.arraycopy(values, 0, tmp, 0, values.length);
                        tmp[values.length] = formFieldValue;
                        formFields.put(fieldName, tmp);
                    }
                } else {
                    String uniqueFilename = new File("file" + Integer.
                            toHexString((int) (Math.random() * 10000)),
                            new File(itemName).getName()).getPath();

                    File savedFile = new File(uploadRoot, uniqueFilename);

                    byte[] data = null;

                    if (item.getSize() > 0)
                        if (chibaBean.storesExternalData(id)) {

                            try {
                                savedFile.getParentFile().mkdir();
                                item.write(savedFile);
                            } catch (Exception e) {
                                throw new XFormsException(e);
                            }
                            try {
                                data = savedFile.toURI().toString().
                                       getBytes(encoding);
                            } catch (UnsupportedEncodingException e) {
                                throw new XFormsException(e);
                            }

                        } else {
                            data = item.get();
                        }
View Full Code Here

TOP

Related Classes of org.chiba.xml.xforms.exception.XFormsException

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.