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


Java PacketError.Condition方法代码示例

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


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

示例1: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * 将错误数据包发送给原始发件人
 * 
 * @param originalPacket
 * @param condition
 */
private void sendErrorPacket(IQ originalPacket,
		PacketError.Condition condition) {
	if (IQ.Type.error == originalPacket.getType()) {
		log.error("不能回答一个IQ错误到另一个IQ错误: " + originalPacket);
		return;
	}
	IQ reply = IQ.createResultIQ(originalPacket);
	reply.setChildElement(originalPacket.getChildElement().createCopy());
	reply.setError(condition);
	try {
		PacketDeliverer.deliver(reply);
	} catch (Exception e) {
		// Ignore
	}
}
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:22,代码来源:IQRouter.java

示例2: toPacketError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Convert a FederationError instance to a PacketError. This may return
 * <undefined-condition> if the incoming error can't be understood.
 *
 * @param error the incoming error
 * @return a generated PacketError instance
 * @throws IllegalArgumentException if the OK error code is given
 */
private static PacketError toPacketError(FederationError error) {
  Preconditions.checkArgument(error.getErrorCode() != FederationError.Code.OK);

  String tag = error.getErrorCode().name().toLowerCase().replace('_', '-');
  PacketError.Condition condition;
  try {
    condition = PacketError.Condition.fromXMPP(tag);
  } catch (IllegalArgumentException e) {
    condition = PacketError.Condition.undefined_condition;
    LOG.warning("Did not understand error condition, defaulting to: " + condition.name());
  }
  PacketError result = new PacketError(condition);
  if (error.hasErrorMessage()) {
    // TODO(thorogood): Hide this behind a flag so we don't always broadcast error cases.
    result.setText(error.getErrorMessage(), "en");
  }
  return result;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:27,代码来源:XmppManager.java

示例3: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Senda the error packet to the original sender
 */
private void sendErrorPacket(IQ originalPacket,
        PacketError.Condition condition) {
    if (IQ.Type.error == originalPacket.getType()) {
        log.error("Cannot reply an IQ error to another IQ error: "
                + originalPacket);
        return;
    }
    IQ reply = IQ.createResultIQ(originalPacket);
    reply.setChildElement(originalPacket.getChildElement().createCopy());
    reply.setError(condition);
    try {
        PacketDeliverer.deliver(reply);
    } catch (Exception e) {
        // Ignore
    }
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:20,代码来源:IQRouter.java

示例4: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
private void sendErrorPacket(IQ originalPacket, PacketError.Condition condition) {
    if (IQ.Type.error == originalPacket.getType()) {
        Log.error("Cannot reply an IQ error to another IQ error: " + originalPacket.toXML());
        return;
    }
    IQ reply = IQ.createResultIQ(originalPacket);
    reply.setChildElement(originalPacket.getChildElement().createCopy());
    reply.setError(condition);
    // Check if the server was the sender of the IQ
    if (serverName.equals(originalPacket.getFrom().toString())) {
        // Just let the IQ router process the IQ error reply
        handle(reply);
        return;
    }
    // Route the error packet to the original sender of the IQ.
    routingTable.routePacket(reply.getTo(), reply, true);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:18,代码来源:IQRouter.java

示例5: queueRequest

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Adds the request to a queue in the workgroup. If the workgroup is closed or the request
 * does not pass a filter then the request will be rejected and this method will return false.
 *
 * @param request the request to add to a queue of this wokrgroup.
 * @return true if the request was added to a queue.
 */
public boolean queueRequest(UserRequest request) {
    // Retrieve routing manager
    RoutingManager routingManager = RoutingManager.getInstance();

    // Check if they require referer validation.
    boolean contains = containsValidReferer(request);
    if (!contains) {
        return false;
    }

    if (getStatus() != Workgroup.Status.OPEN) {
        return false;
    }

    // Check if the request may be accepted by the workgroup
    PacketError.Condition error = requestFilterFactory.getFilter().filter(request);
    if (error == null) {
        synchronized (routingManager) {
            // Add the request to the best queue of the workgroup
            routingManager.routeRequest(this, request);
            return true;
        }
    }
    return false;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:33,代码来源:Workgroup.java

示例6: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
private void sendErrorPacket(IQ originalPacket,
        PacketError.Condition condition) {
    if (IQ.Type.error == originalPacket.getType()) {
        log.error("Cannot reply an IQ error to another IQ error: "
                + originalPacket);
        return;
    }
    IQ reply = IQ.createResultIQ(originalPacket);
    reply.setChildElement(originalPacket.getChildElement().createCopy());
    reply.setError(condition);
    // Check if the server was the sender of the IQ
    if (serverName.equals(originalPacket.getFrom().toString())) {
        // Just let the IQ router process the IQ error reply
        handle(reply);
        return;
    }
    try {
        // Route the error packet to the original sender of the IQ.
        PacketDeliverer.deliver(reply);
    } catch (Exception e) {
        // Ignore
    }
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:24,代码来源:IQRouter.java

示例7: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
private void sendErrorPacket(IQ originalPacket,
        PacketError.Condition condition) {
    if (IQ.Type.error == originalPacket.getType()) {
        log.error("Cannot reply an IQ error to another IQ error: "
                + originalPacket);
        return;
    }
    IQ reply = IQ.createResultIQ(originalPacket);
    reply.setChildElement(originalPacket.getChildElement().createCopy());
    reply.setError(condition);
    try {
        // Route the error packet to the original sender
        PacketDeliverer.deliver(reply);
    } catch (Exception e) {
        // Ignore
    }
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:18,代码来源:IQRouter.java

示例8: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Generate a conflict packet to indicate that the nickname being requested/used is already in
 * use by another user.
 *
 * @param packet the packet to be bounced.
 */
void sendErrorPacket(IQ packet, PacketError.Condition error, Element pubsubError) {
    IQ reply = IQ.createResultIQ(packet);
    reply.setChildElement(packet.getChildElement().createCopy());
    reply.setError(error);
    if (pubsubError != null) {
        // Add specific pubsub error if available
        reply.getError().getElement().add(pubsubError);
    }
    router.route(reply);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:PubSubEngine.java

示例9: sendErrorPacket

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Sends an IQ error with the specified condition to the sender of the original
 * IQ packet.
 *
 * @param packet     the packet to be bounced.
 * @param extraError application specific error or null if none.
 * @param error the error.
 */
private void sendErrorPacket(Route packet, PacketError.Condition error, Element extraError) {
    Route reply = new Route(packet.getStreamID());
    reply.setID(packet.getID());
    reply.setFrom(packet.getTo());
    reply.setTo(packet.getFrom());
    reply.setError(error);
    if (extraError != null) {
        // Add specific application error if available
        reply.getError().getElement().add(extraError);
    }
    deliver(reply);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:21,代码来源:MultiplexerPacketHandler.java

示例10: getSubsriptionError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
@Override
public PacketError.Condition getSubsriptionError() {
       return PacketError.Condition.not_allowed;
   }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:5,代码来源:WhitelistAccess.java

示例11: getSubsriptionError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:5,代码来源:AuthorizeAccess.java

示例12: filter

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
public PacketError.Condition filter(Request request) {
    return null;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:4,代码来源:BasicRequestFilter.java

示例13: getSubsriptionError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
@Override
public PacketError.Condition getSubsriptionError() {
       // Return nothing since users can always subscribe to the node
       return null;
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:6,代码来源:OpenAccess.java

示例14: getSubsriptionError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
@Override
public PacketError.Condition getSubsriptionError() {
       return PacketError.Condition.not_authorized;
   }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:5,代码来源:RosterAccess.java

示例15: getSubsriptionError

import org.xmpp.packet.PacketError; //导入方法依赖的package包/类
/**
 * Returns the error condition that should be returned to the subscriber when
 * subscription is not allowed.
 *
 * @return the error condition that should be returned to the subscriber when
 *         subscription is not allowed.
 */
public abstract PacketError.Condition getSubsriptionError();
 
开发者ID:coodeer,项目名称:g3server,代码行数:9,代码来源:AccessModel.java


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