/** * Constructor. * * @param status * The status to copy. * @param throwable * The related error or exception. */ public Status(final Status status, final Throwable throwable) { this(status.getCode(), throwable, status.getName(), (throwable == null) ? null : throwable.getMessage(), status .getUri()); }
/** * Constructor. * * @param status * The status to copy. * @param description * The description to associate. */ public Status(final Status status, final String description) { this(status.getCode(), status.getName(), description, status.getUri()); }
/** * Returns the name of the status followed by its HTTP code. * * @return The name of the status followed by its HTTP code. */ @Override public String toString() { return getName() + " (" + this.code + ")" + ((getDescription() == null) ? "" : " - " + getDescription()); }
/** * Constructor. * * @param status * The status to copy. * @param throwable * The related error or exception. * @param description * The description to associate. */ public Status(final Status status, final Throwable throwable, final String description) { this(status.getCode(), throwable, status.getName(), description, status .getUri()); }
public Representation getRepresentation(final Status status, final Request request, final Response response) { final HashMap<String, Object> dataModel = new HashMap<String, Object>(); final SystemStatus systemStatus = applicationStatusSource.getSystemStatus(); dataModel.put("request", request); dataModel.put("nexusVersion", systemStatus.getVersion()); dataModel.put("nexusRoot", BaseUrlHolder.get()); dataModel.put("statusCode", status.getCode()); dataModel.put("statusName", status.getName()); dataModel.put("errorDescription", StringEscapeUtils.escapeHtml(status.getDescription())); if (null != status.getThrowable()) { dataModel.put("errorStackTrace", StringEscapeUtils.escapeHtml(ExceptionUtils.getStackTrace(status.getThrowable()))); } final VelocityRepresentation representation = new VelocityRepresentation(Context.getCurrent(), "/templates/errorPageContentHtml.vm", getClass().getClassLoader(), dataModel, MediaType.TEXT_HTML); return representation; } }
public Representation getRepresentation( final Status status, final Request request, final Response response ) { final HashMap<String, Object> dataModel = new HashMap<String, Object>(); dataModel.put( "request", request ); dataModel.put( "nexusVersion", nexus.getSystemStatus().getVersion() ); dataModel.put( "nexusRoot", referenceFactory.getContextRoot( request ).toString() ); dataModel.put( "statusCode", status.getCode() ); dataModel.put( "statusName", status.getName() ); dataModel.put( "errorDescription", StringEscapeUtils.escapeHtml( status.getDescription() ) ); if ( null != status.getThrowable() ) { dataModel.put( "errorStackTrace", StringEscapeUtils.escapeHtml( ExceptionUtils.getStackTrace( status.getThrowable() ) ) ); } // Load up the template, and pass in the data VelocityRepresentation representation = new VelocityRepresentation( Context.getCurrent(), "/templates/errorPageContentHtml.vm", dataModel, MediaType.TEXT_HTML ); return representation; } }
errorMessage = response.getStatus().getName();
assertThat("Could not unblock proxy: " + repoId + ", status: " + response.getStatus().getName() + " (" + response.getStatus().getCode() + ") - " + response.getStatus().getDescription(), response, isSuccessful());
assertThat( "Could not unblock proxy: " + repoId + ", status: " + response.getStatus().getName() + " (" + response.getStatus().getCode() + ") - " + response.getStatus().getDescription(), response, isSuccessful() );