Package org.apache.wink.common

Examples of org.apache.wink.common.RestException


            result = handler.getResult();
            if (result instanceof JAXBElement<?>) {
                result = ((JAXBElement<?>)result).getValue();
            }
        } catch (IllegalStateException e) {
            throw new RestException("failed to unmarshal object", e);
        } catch (JAXBException e) {
            throw new RestException("failed to unmarshal object", e);
        }
        return result;
    }
View Full Code Here


            // will receive all the
            // SAX events
            ContentHandler xmlSerializer = handler.asContentHandler();
            marshaller.marshal(jaxbObject, xmlSerializer);
        } catch (JAXBException e) {
            throw new RestException("failed to marshal object (" + jaxbObject.getClass().getName()
                + ")", e);
        }
    }
View Full Code Here

                    for (String key : keys) {
                        try {
                            attributes = processingInstructions.get(key);
                            super.processingInstruction(key, attributes);
                        } catch (SAXException e) {
                            throw new RestException("failed to add processing instruction '" + key
                                + "' with attributes '"
                                + attributes
                                + "'", e);
                        }
                    }
View Full Code Here

                specialContentHandler = new SpecialContentHandler(target);
                try {
                    specialContentHandler.startDocument();
                } catch (SAXException e) {
                    // shouldn't happen
                    throw new RestException("xmlSerializer failed", e);
                }
            }
View Full Code Here

            public String endSpecialContent() {
                try {
                    specialContentHandler.endDocument();
                } catch (SAXException e) {
                    // shouldn't happen
                    throw new RestException("xmlSerializer failed", e);
                }
                String contentStr = specialContentHandler.getResult();
                return contentStr;
            }
View Full Code Here

    public boolean hasNext() {
        if (!moved) {
            try {
                lastMoveResult = MPParser.nextPart();
            } catch (IOException e) {
                throw new RestException(e);
            }
            moved = true;
            index++;
        }
        return lastMoveResult;
View Full Code Here

        this.any = any;
    }

    public void checkValidity() {
        if (src != null && any != null) {
            throw new RestException("Content element may have either inline or out-of-line content");
        } else if (src != null && type != null) {
            if (type.equals("text") || type.equals("html") || type.equals("xhtml")) {
                throw new RestException(
                                        "Type attribute of content element must be a valid mime type when content is out-of-line");
            }
        }
    }
View Full Code Here

            Marshaller marshaller = context.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            return marshaller;
        } catch (JAXBException e) {
            throw new RestException(Messages.getMessage("webDAVFailCreateMarshaller"), e); //$NON-NLS-1$
        }
    }
View Full Code Here

    public static Unmarshaller createUnmarshaller() {
        try {
            Unmarshaller unmarshaller = context.createUnmarshaller();
            return unmarshaller;
        } catch (JAXBException e) {
            throw new RestException(Messages.getMessage("webDAVFailCreateUnmarshaller"), e); //$NON-NLS-1$
        }
    }
View Full Code Here

    public static void marshal(Marshaller m, Object element, Writer writer, String elementName) {
        try {
            m.marshal(element, writer);
        } catch (JAXBException e) {
            throw new RestException(Messages
                .getMessage("webDAVUnableToMarshalElement", elementName), e); //$NON-NLS-1$
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.RestException

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.