当前位置: 首页>>代码示例>>Java>>正文


Java XmppStringUtils.parseDomain方法代码示例

本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.parseDomain方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.parseDomain方法的具体用法?Java XmppStringUtils.parseDomain怎么用?Java XmppStringUtils.parseDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jxmpp.util.XmppStringUtils的用法示例。


在下文中一共展示了XmppStringUtils.parseDomain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPostExecute

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
protected void onPostExecute(Boolean result) {
    CollectionViewActivity myActivity = CollectionViewActivity.this ;
    if ( result ) {
        Log.d(LOGTAG , "Now we have a working connection" );

        // TODO: Do this in a safe way
        // Anyway if the connection is configured it should be already a current entity
        if ( myActivity.currentEntity == null ) {
            myActivity.currentEntity = new Entity(XmppStringUtils.parseDomain(user), null, null);
        }

        myActivity.setTitle( myActivity.currentEntity.getDisplayName() );

        myActivity.childLoader = new LoadChildEntitiesTask() ;
        myActivity.childLoader.execute( myActivity );
    } else {
        Log.d(LOGTAG , "No connection" );
        //Call the settings activity
        Intent intent = new Intent( myActivity, SettingsActivity.class);
        startActivityForResult(intent , 1 );
        Log.d(LOGTAG , "Subactivity launched" );
    }
}
 
开发者ID:marevalo,项目名称:FlowsManager,代码行数:24,代码来源:CollectionViewActivity.java

示例2: validateEntityBareJid

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Check if the given CharSequence is a valid entity bare JID. That
 * is, it must consists exactly of a local- and a domainpart
 * (<[email protected]>).
 * <p>
 * This is a convenience method meant to validate user entered bare JIDs. If
 * the given {@code jid} is not a valid bare JID, then this method will
 * throw either {@link NotAEntityBareJidStringException} or
 * {@link XmppStringprepException}. The NotABareJidStringException will
 * contain a meaningful message explaining why the given CharSequence is not a
 * valid bare JID (e.g. "does not contain a '@' character").
 * </p>
 * 
 * @param jidcs the JID CharSequence
 * @return a BareJid instance representing the given JID CharSequence
 * @throws NotAEntityBareJidStringException if the given CharSequence is not a bare JID.
 * @throws XmppStringprepException if an error happens.
 */
public static EntityBareJid validateEntityBareJid(CharSequence jidcs) throws NotAEntityBareJidStringException, XmppStringprepException {
	String jid = jidcs.toString();
	final int atIndex = jid.indexOf('@');
	if (atIndex == -1) {
		throw new NotAEntityBareJidStringException("'" + jid + "' does not contain a '@' character");
	} else if (jid.indexOf('@', atIndex + 1) != -1) {
		throw new NotAEntityBareJidStringException("'" + jid + "' contains multiple '@' characters");
	}
	final String localpart = XmppStringUtils.parseLocalpart(jid);
	if (localpart.length() == 0) {
		throw new NotAEntityBareJidStringException("'" + jid + "' has empty localpart");
	}
	final String domainpart = XmppStringUtils.parseDomain(jid);
	if (domainpart.length() == 0) {
		throw new NotAEntityBareJidStringException("'" + jid + "' has empty domainpart");
	}
	return JidCreate.entityBareFromUnescaped(jid);
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:37,代码来源:JidUtil.java

示例3: bareFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link BareJid} representing the given String.
 *
 * @param jid the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static BareJid bareFrom(String jid) throws XmppStringprepException {
	BareJid bareJid = BAREJID_CACHE.lookup(jid);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	try {
		if (localpart.length() != 0) {
			bareJid = new LocalAndDomainpartJid(localpart, domainpart);
		} else {
			bareJid = new DomainpartJid(domainpart);
		}
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	BAREJID_CACHE.put(jid, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:28,代码来源:JidCreate.java

示例4: fullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link FullJid} representing the given String.
 *
 * @param jid the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static FullJid fullFrom(String jid) throws XmppStringprepException {
	FullJid fullJid = FULLJID_CACHE.lookup(jid);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		fullJid = fullFrom(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	FULLJID_CACHE.put(jid, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例5: entityBareFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityBareJid} representing the given String.
 *
 * @param jid the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityBareJid entityBareFrom(String jid) throws XmppStringprepException {
	EntityBareJid bareJid = ENTITY_BAREJID_CACHE.lookup(jid);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	try {
		bareJid = new LocalAndDomainpartJid(localpart, domainpart);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	ENTITY_BAREJID_CACHE.put(jid, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:24,代码来源:JidCreate.java

示例6: entityBareFromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityBareJid} representing the given unescaped String.
 *
 * @param unescapedJidString the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityBareJid entityBareFromUnescaped(String unescapedJidString) throws XmppStringprepException {
	EntityBareJid bareJid = ENTITY_BAREJID_CACHE.lookup(unescapedJidString);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	try {
		bareJid = new LocalAndDomainpartJid(localpart, domainpart);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}
	ENTITY_BAREJID_CACHE.put(unescapedJidString, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:27,代码来源:JidCreate.java

示例7: entityFullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given String.
 *
 * @param jid the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(jid);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		fullJid = entityFullFrom(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	ENTITY_FULLJID_CACHE.put(jid, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例8: entityFullFromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given unescaped String.
 *
 * @param unescapedJidString the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFromUnescaped(String unescapedJidString) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(unescapedJidString);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	String resource = XmppStringUtils.parseResource(unescapedJidString);
	try {
		fullJid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}

	ENTITY_FULLJID_CACHE.put(unescapedJidString, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:29,代码来源:JidCreate.java

示例9: domainBareFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a domain bare JID.
 *
 * @param jid the JID String.
 * @return a domain bare JID.
 * @throws XmppStringprepException if an error occurs.
 */
public static DomainBareJid domainBareFrom(String jid) throws XmppStringprepException {
	DomainBareJid domainJid = DOMAINJID_CACHE.lookup(jid);
	if (domainJid != null) {
		return domainJid;
	}

	String domain = XmppStringUtils.parseDomain(jid);
	try {
		domainJid = new DomainpartJid(domain);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	DOMAINJID_CACHE.put(jid, domainJid);
	return domainJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:23,代码来源:JidCreate.java

示例10: domainFullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a domain full JID from the given String.
 *
 * @param jid the JID.
 * @return a DomainFullJid.
 * @throws XmppStringprepException if an error happens.
 */
public static DomainFullJid domainFullFrom(String jid) throws XmppStringprepException {
	DomainFullJid domainResourceJid = DOMAINRESOURCEJID_CACHE.lookup(jid);
	if (domainResourceJid != null) {
		return domainResourceJid;
	}

	String domain = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		domainResourceJid = new DomainAndResourcepartJid(domain, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	DOMAINRESOURCEJID_CACHE.put(jid, domainResourceJid);
	return domainResourceJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:24,代码来源:JidCreate.java

示例11: setConfiguration

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static Void setConfiguration ( String xmppUser , String xmppPassword ) {
    // TODO: validate xmppUser
    XMPPConnectionManager.isConfigured = true;
    XMPPConnectionManager.xmppPassword = xmppPassword ;
    XMPPConnectionManager.xmppUserName = XmppStringUtils.parseLocalpart( xmppUser ) ;
    XMPPConnectionManager.xmppUserDomain = XmppStringUtils.parseDomain( xmppUser ) ;
    return null;
}
 
开发者ID:marevalo,项目名称:FlowsManager,代码行数:9,代码来源:XMPPConnectionManager.java

示例12: bindResourceAndEstablishSession

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void bindResourceAndEstablishSession(String resource) throws XMPPErrorException,
                IOException, SmackException {

    // Wait until either:
    // - the servers last features stanza has been parsed
    // - the timeout occurs
    LOGGER.finer("Waiting for last features to be received before continuing with resource binding");
    lastFeaturesReceived.checkIfSuccessOrWait();


    if (!hasFeature(Bind.ELEMENT, Bind.NAMESPACE)) {
        // Server never offered resource binding, which is REQURIED in XMPP client and
        // server implementations as per RFC6120 7.2
        throw new ResourceBindingNotOfferedException();
    }

    // Resource binding, see RFC6120 7.
    // Note that we can not use IQReplyFilter here, since the users full JID is not yet
    // available. It will become available right after the resource has been successfully bound.
    Bind bindResource = Bind.newSet(resource);
    PacketCollector packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(bindResource), bindResource);
    Bind response = packetCollector.nextResultOrThrow();
    // Set the connections user to the result of resource binding. It is important that we don't infer the user
    // from the login() arguments and the configurations service name, as, for example, when SASL External is used,
    // the username is not given to login but taken from the 'external' certificate.
    user = response.getJid();
    serviceName = XmppStringUtils.parseDomain(user);

    Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE);
    // Only bind the session if it's announced as stream feature by the server, is not optional and not disabled
    // For more information see http://tools.ietf.org/html/draft-cridland-xmpp-session-01
    if (sessionFeature != null && !sessionFeature.isOptional() && !getConfiguration().isLegacySessionDisabled()) {
        Session session = new Session();
        packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(session), session);
        packetCollector.nextResultOrThrow();
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:39,代码来源:AbstractXMPPConnection.java

示例13: isEmailAvailable

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * The workgroup service may be configured to send email. This queries the Workgroup Service
 * to see if the email service has been configured and is available.
 *
 * @return true if the email service is available, otherwise return false.
 * @throws SmackException 
 */
public boolean isEmailAvailable() throws SmackException {
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);

    try {
        String workgroupService = XmppStringUtils.parseDomain(workgroupJID);
        DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
        return infoResult.containsFeature("jive:email:provider");
    }
    catch (XMPPException e) {
        return false;
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:Workgroup.java

示例14: from

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link Jid} from the given String.
 *
 * @param jidString the input String.
 * @return the Jid represented by the input String.
 * @throws XmppStringprepException if an error occurs.
 * @see #from(CharSequence)
 */
public static Jid from(String jidString) throws XmppStringprepException {
	String localpart = XmppStringUtils.parseLocalpart(jidString);
	String domainpart = XmppStringUtils.parseDomain(jidString);
	String resource = XmppStringUtils.parseResource(jidString);
	try {
		return from(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jidString, e);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:19,代码来源:JidCreate.java

示例15: fromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link Jid} from the given unescaped String.
 *
 * @param unescapedJidString a unescaped String representing a JID.
 * @return a JID.
 * @throws XmppStringprepException if an error occurs.
 */
public static Jid fromUnescaped(String unescapedJidString) throws XmppStringprepException {
	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	String resource = XmppStringUtils.parseResource(unescapedJidString);
	try {
		return from(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:21,代码来源:JidCreate.java


注:本文中的org.jxmpp.util.XmppStringUtils.parseDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。