public String getMimeType(Object value, Operation operation) { Object request = operation.getParameters()[0]; if (request instanceof GetExecutionStatusType) { return "text/xml"; } else if (request instanceof GetExecutionResultType) { GetExecutionResultType ger = (GetExecutionResultType) request; if (ger.getMimeType() != null) { return ger.getMimeType(); } else { // generic binary output... return "application/octet-stream"; } } else { throw new WPSException( "Trying to get a mime type for a unknown operation, " + "we should not have got here in the first place"); } }
@Override public String getAttachmentFileName(Object value, Operation operation) { Object request = operation.getParameters()[0]; if (request instanceof GetExecutionStatusType) { return "text/xml"; } else if (request instanceof GetExecutionResultType) { GetExecutionResultType ger = (GetExecutionResultType) request; if (ger.getOutputId() != null) { return ger.getOutputId(); } else { // we should really never get here, the request should fail before return "result.dat"; } } else { throw new WPSException( "Trying to get a file name for a unknown operation, " + "we should not have got here in the first place"); } }