mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
removed 404 handling
This commit is contained in:
parent
8b98a92805
commit
ddb1d6e0d3
@ -11,6 +11,7 @@ import java.util.*;
|
|||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataMultiPart;
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
import com.sun.jersey.multipart.file.FileDataBodyPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
@ -77,7 +78,8 @@ public class {{classname}} {
|
|||||||
mp.field("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), MediaType.MULTIPART_FORM_DATA_TYPE);
|
mp.field("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
{{/notFile}}{{#isFile}}
|
{{/notFile}}{{#isFile}}
|
||||||
hasFields = true;
|
hasFields = true;
|
||||||
mp.field("{{baseName}}", {{paramName}}, MediaType.MULTIPART_FORM_DATA_TYPE);
|
mp.field("{{baseName}}", file.getName());
|
||||||
|
mp.bodyPart(new FileDataBodyPart("{{baseName}}", {{paramName}}, MediaType.MULTIPART_FORM_DATA_TYPE));
|
||||||
{{/isFile}}{{/formParams}}
|
{{/isFile}}{{/formParams}}
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
@ -96,12 +98,7 @@ public class {{classname}} {
|
|||||||
return {{#returnType}}null{{/returnType}};
|
return {{#returnType}}null{{/returnType}};
|
||||||
}
|
}
|
||||||
} catch (ApiException ex) {
|
} catch (ApiException ex) {
|
||||||
if(ex.getCode() == 404) {
|
throw ex;
|
||||||
return {{#returnType}} null{{/returnType}};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
Loading…
Reference in New Issue
Block a user