本文整理汇总了Java中org.easyrec.model.core.web.ErrorMessage类的典型用法代码示例。如果您正苦于以下问题:Java ErrorMessage类的具体用法?Java ErrorMessage怎么用?Java ErrorMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorMessage类属于org.easyrec.model.core.web包,在下文中一共展示了ErrorMessage类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshalResponseXml
import org.easyrec.model.core.web.ErrorMessage; //导入依赖的package包/类
private void marshalResponseXml(GeneratorsResponse generatorsResponse, OutputStream output) {
try {
Set<Class<?>> classes = Sets.newHashSet(GeneratorsResponse.class, GeneratorResponse.class,
ErrorMessage.class, SuccessMessage.class);
for(GeneratorResponse generatorResponse : generatorsResponse.getGeneratorResponses()) {
Object content = generatorResponse.getMessage().getContent();
// TODO workaround classes that are not @XmlRootElement annotated
if(content != null)
classes.add(content.getClass());
}
Class[] classesArray = classes.toArray(new Class[classes.size()]);
JAXBContext jaxbContext = JAXBContext.newInstance(classesArray);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(generatorsResponse, output);
} catch (JAXBException e) {
logger.error("failed to marshal response!", e);
}
}
示例2: GeneratorResponse
import org.easyrec.model.core.web.ErrorMessage; //导入依赖的package包/类
public GeneratorResponse(Message message, String action, PluginId pluginId) {
if (message.getClass().equals(ErrorMessage.class))
errorMessage = (ErrorMessage) message;
else
successMessage = (SuccessMessage) message;
this.action = action;
this.pluginId = pluginId;
}