public void testGetMimeType() { assertEquals("application/xml", response.getMimeType(null, null)); }
@Override public String getMimeType(Object value, Operation operation) throws ServiceException { if (isStandardDocumentResponse(operation)) { // normal execute response encoding return standardResponse.getMimeType(value, operation); } else { // raw response, let's see what the output is ExecuteResponseType response = (ExecuteResponseType) value; if(response.getProcessOutputs() == null) { // just a status report or a failure report return "text/xml"; } OutputDataType result = (OutputDataType) response.getProcessOutputs().getOutput().get(0); LiteralDataType literal = result.getData().getLiteralData(); ComplexDataType complex = result.getData().getComplexData(); if(literal != null) { // literals are encoded as plain strings return "text/plain"; } else if(complex != null) { // Execute should have properly setup the mime type return complex.getMimeType(); } else { // bbox return "text/xml"; } } }
@Override public String getMimeType(Object value, Operation operation) throws ServiceException { if (isStandardDocumentResponse(operation)) { // normal execute response encoding return standardResponse.getMimeType(value, operation); } else { // raw response, let's see what the output is ExecuteResponseType response = (ExecuteResponseType) value; if (response.getProcessOutputs() == null) { // just a status report or a failure report return "text/xml"; } OutputDataType result = (OutputDataType) response.getProcessOutputs().getOutput().get(0); LiteralDataType literal = result.getData().getLiteralData(); ComplexDataType complex = result.getData().getComplexData(); if (literal != null) { // literals are encoded as plain strings return "text/plain"; } else if (complex != null) { // Execute should have properly setup the mime type return complex.getMimeType(); } else { // bbox return "text/xml"; } } }