Package org.apache.wink.common

Examples of org.apache.wink.common.RestException


            Object object = u.unmarshal(reader);
            if (object instanceof JAXBElement) {
                object = ((JAXBElement<?>)object).getValue();
            }
            if (!(elementClass.equals(object.getClass()))) {
                throw new RestException(Messages
                    .getMessage("webDAVIncompatibleTypeInRequest", elementName, object.getClass() //$NON-NLS-1$
                    .getName(), elementClass.getName()));
            }
            return (T)object;
        } catch (JAXBException e) {
            throw new RestException(Messages.getMessage("webDAVUnableToParseElement", elementName), //$NON-NLS-1$
                                    e);
        }
    }
View Full Code Here


     */
    public Date getValueAsDate() {
        try {
            return WebDAVModelHelper.convertXMLDateToDate(getValue());
        } catch (ParseException e) {
            throw new RestException(e);
        }
    }
View Full Code Here

     */
    public static AppService unmarshal(Reader reader) {
        try {
            return (AppService)ModelUtils.unmarshal(AppService.getUnmarshaller(), reader);
        } catch (IOException e) {
            throw new RestException(e);
        }
    }
View Full Code Here

     */
    public static AppCategories unmarshal(Reader reader) {
        try {
            return (AppCategories)ModelUtils.unmarshal(AppCategories.getUnmarshaller(), reader);
        } catch (IOException e) {
            throw new RestException(e);
        }
    }
View Full Code Here

     * Objects of the following type(s) are allowed in the list
     * {@link AtomCategory }
     */
    public List<AtomCategory> getCategory() {
        if (!isInline()) {
            throw new RestException(ERROR_MESSAGE);
        }
        return getCategoryNoCheck();
    }
View Full Code Here

        return getHref() == null;
    }

    public void checkValidity() {
        if ((getScheme() != null || getCategoryNoCheck().size() > 0 || isFixedSet()) && getHref() != null) {
            throw new RestException(ERROR_MESSAGE);
        }
    }
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

    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(Messages.getMessage("contentMayHaveInlineOrOutContent")); //$NON-NLS-1$
        } else if (src != null && type != null) {
            if (type.equals("text") || type.equals("html") || type.equals("xhtml")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                throw new RestException(
                                        Messages.getMessage("typeAttribMustHaveValidMimeType")); //$NON-NLS-1$
            }
        }
    }
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

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.