Package org.openid4java.discovery.yadis

Examples of org.openid4java.discovery.yadis.YadisException


            }
        }

        NodeList heads = doc.getElementsByTagName("head");
        if (heads.getLength() != 1)
            throw new YadisException(
                    "HTML response must have exactly one HEAD element, "
                            + "found " + heads.getLength() + " : "
                            + heads.toString(),
                    OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);

        HTMLHeadElement head = (HTMLHeadElement) doc.getHead();
        NodeList metaElements = head.getElementsByTagName("META");
        if (metaElements == null || metaElements.getLength() == 0)
        {
            if (DEBUG)
                _log.debug("No <meta> element found under <html><head>. " +
                "See Yadis specification, section 6.2.5/1.");
        }
        else
        {
            for (int i = 0, len = metaElements.getLength(); i < len; i++)
            {
                HTMLMetaElement metaElement = (HTMLMetaElement) metaElements.item(i);

                String httpEquiv = metaElement.getHttpEquiv();
                if (YadisResolver.YADIS_XRDS_LOCATION.equalsIgnoreCase(httpEquiv))
                {
                    if (xrdsLocation != null)
                        throw new YadisException(
                            "More than one "
                                + YadisResolver.YADIS_XRDS_LOCATION
                                + "META tags found in HEAD: "
                                + head.toString(),
                            OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);
View Full Code Here


        {
            parser.parse(OpenID4JavaDOMParser.createInputSource(htmlData));
        }
        catch (Exception e)
        {
            throw new YadisException("Error parsing HTML message",
                    OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE, e);
        }

        if (parser.isIgnoredHeadStartElement())
        {
                throw new YadisException("HTML response must have exactly one HEAD element.",
                                OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);
        }

        return (HTMLDocumentImpl) parser.getDocument();
    }
View Full Code Here

TOP

Related Classes of org.openid4java.discovery.yadis.YadisException

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.