本文整理匯總了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;
}