/* * Copyright 2014 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.apiman.gateway.engine.beans; import java.io.PrintWriter; import java.io.Serializable; import java.io.StringWriter; import javax.xml.bind.annotation.XmlRootElement; /** * Models an error from the engine. * * @author Marc Savy <msavy@redhat.com> */ @XmlRootElement public class EngineErrorResponse implements Serializable { private static final long serialVersionUID = 8881390951647532958L; private int responseCode; private String message; private String trace; /** * Constructor. */ public EngineErrorResponse() { } /** * @return the responseCode */ public int getResponseCode() { return responseCode; } /** * @param responseCode the responseCode to set */ public void setResponseCode(int responseCode) { this.responseCode = responseCode; } /** * @return the message */ public String getMessage() { return message; } /** * @param message the message to set */ public void setMessage(String message) { this.message = message; } /** * @return the trace */ public String getTrace() { return trace; } /** * @param trace the trace to set */ public void setTrace(String trace) { this.trace = trace; } /** * @param t the error stack trace */ public void setTrace(Throwable t) { StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); setTrace(sw.getBuffer().toString()); } }