本文整理汇总了Java中flex.messaging.messages.ErrorMessage类的典型用法代码示例。如果您正苦于以下问题:Java ErrorMessage类的具体用法?Java ErrorMessage怎么用?Java ErrorMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorMessage类属于flex.messaging.messages包,在下文中一共展示了ErrorMessage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getXStream
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
public static XStream getXStream() {
if (xstream == null) {
xstream = new XStream(new DomDriver());
xstream.alias("ActionMessage", ActionMessage.class);
xstream.alias("MessageHeader", MessageHeader.class);
xstream.alias("MessageBody", MessageBody.class);
xstream.alias("RemotingMessage", RemotingMessage.class);
xstream.alias("CommandMessage", CommandMessage.class);
xstream.alias("AcknowledgeMessage", AcknowledgeMessage.class);
xstream.alias("ErrorMessage", ErrorMessage.class);
xstream.alias("ASObject", ASObject.class);
xstream.alias("AsyncMessage", AsyncMessage.class);
xstream.alias("DSC", CommandMessageExt.class);
// xstream.alias("DSK", AcknowledgeMessageExt.class);
// Better ASObject Converter
Mapper mapper = xstream.getMapper();
xstream.registerConverter(new ASObjectConverter(mapper));
}
return xstream;
}
示例2: createErrorMessage
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Overrides <code>createErrorMessage()</code> to correlate the <code>ErrorMessage</code> to the
* failing message by id and destination.
*
* @return correlated error message
*/
public ErrorMessage createErrorMessage()
{
ErrorMessage msg = super.createErrorMessage();
if (failingMessage != null)
{
msg.setCorrelationId(failingMessage.getMessageId());
msg.setDestination(failingMessage.getDestination());
}
return msg;
}
示例3: getErrorMessage
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Returns the error message of the exception.
*
* @return The error message of the exception.
*/
public ErrorMessage getErrorMessage()
{
if (errorMessage == null)
{
errorMessage = createErrorMessage();
}
return errorMessage;
}
示例4: createErrorMessage
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Creates an error message from the exception.
*
* @return The error message.
*/
public ErrorMessage createErrorMessage()
{
ErrorMessage msg = new ErrorMessage();
msg.faultCode = code != null? code : "Server.Processing";
msg.faultString = message;
msg.faultDetail = details;
msg.rootCause = getRootCauseErrorMessage();
if (extendedData != null)
msg.extendedData = extendedData;
if (statusCode != 0)
msg.setHeader(Message.STATUS_CODE_HEADER, statusCode);
return msg;
}
示例5: removeConsumer
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Removes (unsubscribes) the JMSConsumer associated with the clientId.
*
* @param clientId The clientId associated with the JMSConsumer to remove.
* @param unsubscribe Whether to unsubscribe the durable subscription or not.
* @param invalidate Whether to invalidate the MessageClient or not.
* @param invalidateMessage A message to push to the client before consumer
* is removed and its MessageClient is invalidated. If the message is null,
* MessageClient is invalidated silently.
*/
protected void removeConsumer(Object clientId, boolean unsubscribe, boolean invalidate, ErrorMessage invalidateMessage)
{
JMSConsumer consumer = null;
if (topicConsumers.containsKey(clientId))
consumer = topicConsumers.get(clientId);
else if (queueConsumers.containsKey(clientId))
consumer = queueConsumers.get(clientId);
removeConsumer(consumer, unsubscribe, invalidate, invalidateMessage);
}
示例6: logAtHingePoint
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Invoked at hinge-points in server processing where catch-all exception logging is performed.
* This method uses <code>isLogged()</code> and <code>setLogged()</code> to avoid repeat logging
* of the same exception and uses <code>getPreferredLogLevel()</code> which may be
* overridden in subclasses to control the log level that the logging is output at.
* The underlying exception stack traces are also conditionally included in log output
* if the exception class allows it and this is determined by invoking <code>isLogStackTraceEnabled()</code>
*
* @param inboundMessage The inbound message that triggered an exception during processing.
* @param outboundMessage The outbound <code>ErrorMessage</code>, which may be null depending on whether it has been generated
* or not at the point this method is invoked.
* @param logMessageIntro The beginning text for the log message, which may be null; default value is returned by <code>getDefaultLogMessageIntro()</code>.
*/
public void logAtHingePoint(Message inboundMessage, ErrorMessage outboundMessage, String logMessageIntro)
{
if (!isLogged())
{
setLogged(true);
short preferredLevel = getPreferredLogLevel();
// If the preferred level is less than the current Log level; return early.
if (preferredLevel < Log.getTargetLevel())
return;
// Construct core log output.
StringBuffer output = new StringBuffer();
output.append((logMessageIntro != null) ? logMessageIntro : getDefaultLogMessageIntro());
output.append(this.toString());
output.append(StringUtils.NEWLINE);
output.append(" incomingMessage: ");
output.append(inboundMessage);
output.append(StringUtils.NEWLINE);
if (outboundMessage != null)
{
output.append(" errorReply: ");
output.append(outboundMessage);
output.append(StringUtils.NEWLINE);
}
if (isLogStackTraceEnabled())
{
output.append(ExceptionUtil.exceptionFollowedByRootCausesToString(this));
output.append(StringUtils.NEWLINE);
}
switch (preferredLevel)
{
case LogEvent.FATAL:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal(output.toString());
break;
}
case LogEvent.ERROR:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).error(output.toString());
break;
}
case LogEvent.WARN:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).warn(output.toString());
break;
}
case LogEvent.INFO:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).info(output.toString());
break;
}
case LogEvent.DEBUG:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).debug(output.toString());
break;
}
default:
{
Log.getLogger(LogCategories.MESSAGE_GENERAL).fatal("Failed to log exception for handling message due to an invalid preferred log level: " + preferredLevel);
break;
}
}
}
}
示例7: getResponseTarget
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
private static String getResponseTarget(AMF0Body requestBody, Message responseMessage) {
if (responseMessage instanceof ErrorMessage) {
return requestBody.getResponse() + "/onStatus";
}
return requestBody.getResponse() + "/onResult";
}
示例8: setErrorMessage
import flex.messaging.messages.ErrorMessage; //导入依赖的package包/类
/**
* Sets the error message of the exception.
*
* @param errorMessage The error message of the exception.
*/
public void setErrorMessage(ErrorMessage errorMessage)
{
this.errorMessage = errorMessage;
}