本文整理汇总了Java中eu.atos.sla.parser.data.ErrorResponse.setCode方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorResponse.setCode方法的具体用法?Java ErrorResponse.setCode怎么用?Java ErrorResponse.setCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.atos.sla.parser.data.ErrorResponse
的用法示例。
在下文中一共展示了ErrorResponse.setCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printError
import eu.atos.sla.parser.data.ErrorResponse; //导入方法依赖的package包/类
protected String printError(int code, String text) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setCode(code);
errorResponse.setMessage(text);
JAXBContext jaxbContext;
jaxbContext = JAXBContext
.newInstance(eu.atos.sla.parser.data.ErrorResponse.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(errorResponse, out);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return out.toString();
}
示例2: printError
import eu.atos.sla.parser.data.ErrorResponse; //导入方法依赖的package包/类
protected String printError(int code, String text) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setCode(code);
errorResponse.setMessage(text);
JAXBContext jaxbContext;
jaxbContext = JAXBContext
.newInstance(eu.atos.sla.parser.data.ErrorResponse.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(errorResponse, out);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return out.toString();
}
示例3: buildResponse
import eu.atos.sla.parser.data.ErrorResponse; //导入方法依赖的package包/类
static protected Response buildResponse(Status status, Exception e) {
int code = status.getStatusCode();
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setCode(code);
errorResponse.setMessage(e.getMessage());
logger.info("Sending error {} - {} - {}", code, e.getMessage(), status.getReasonPhrase());
return Response
.status(status)
.entity(errorResponse)
.build();
}
示例4: buildResponse
import eu.atos.sla.parser.data.ErrorResponse; //导入方法依赖的package包/类
static protected Response buildResponse(Status status, Exception e) {
int code = status.getStatusCode();
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setCode(code);
errorResponse.setMessage(e.getMessage());
logger.info("Sending error {} - {} - {}", code, e.getMessage(), status.getReasonPhrase());
return Response
.status(status)
.entity(errorResponse)
.build();
}