Forum Discussion
Unibet_Support
14 years agoContributor
Hi,
Yes.It does make sense.But i realised that having file directory path harcoded isnt a feasible option as we would have nightmares doing automated deployments and stuff.
So what i did was export soapui war and set it as a maven project and than add these files in src/resources directory so that its accessible under classpath.
So this is my groovy script code.
But this is causing me issues with setting content-type.Somewhere this ContentTypeHandler.getContentTypeFromFilename() method is getting called and the content-type is set to application/octet-stream which is default.Any ideas why its happening like this?
Thanks
Yes.It does make sense.But i realised that having file directory path harcoded isnt a feasible option as we would have nightmares doing automated deployments and stuff.
So what i did was export soapui war and set it as a maven project and than add these files in src/resources directory so that its accessible under classpath.
So this is my groovy script code.
def httpResponse = mockRequest.httpResponse
def fileInputStream= this.getClass().getClassLoader().getParent().getResourceAsStream(mockServerResponseDir + responseFileName)
httpResponse.setStatus(httpStatusCode)
def length = IOUtils.copy(fileInputStream, httpResponse.getOutputStream())
httpResponse.setContentLength( ( int )length )
httpResponse.setContentType( 'application/json' )
fileInputStream.close()
return new com.eviware.soapui.impl.wsdl.mock.WsdlMockResult(mockRequest)
But this is causing me issues with setting content-type.Somewhere this ContentTypeHandler.getContentTypeFromFilename() method is getting called and the content-type is set to application/octet-stream which is default.Any ideas why its happening like this?
Thanks