fixed CXF upload attachment

This commit is contained in:
Brian Long 2022-03-03 10:14:43 -05:00
parent eebf265227
commit 2c97a6f865
2 changed files with 9 additions and 6 deletions

View File

@ -8,8 +8,10 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import com.inteligr8.alfresco.acs.model.Error; import com.inteligr8.alfresco.acs.model.Error;
import com.inteligr8.alfresco.acs.model.NodeBodyCreate; import com.inteligr8.alfresco.acs.model.NodeBodyCreate;
@ -26,8 +28,8 @@ public interface NodesCxfApi {
@POST @POST
@Path("/nodes/{nodeId}/children") @Path("/nodes/{nodeId}/children")
@Consumes({ "application/json", "multipart/form-data" }) @Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ "application/json" }) @Produces({ MediaType.APPLICATION_JSON })
@ApiOperation(value = "Create a node", tags={ }) @ApiOperation(value = "Create a node", tags={ })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class), @ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class),
@ -43,12 +45,12 @@ public interface NodesCxfApi {
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) }) @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
public NodeEntry createNode( public NodeEntry createNode(
@PathParam("nodeId") String nodeId, @PathParam("nodeId") String nodeId,
NodeBodyCreate nodeBodyCreate, @Multipart NodeBodyCreate nodeBodyCreate,
@QueryParam("autoRename") Boolean autoRename, @QueryParam("autoRename") Boolean autoRename,
@QueryParam("majorVersion") Boolean majorVersion, @QueryParam("majorVersion") Boolean majorVersion,
@QueryParam("versioningEnabled") Boolean versioningEnabled, @QueryParam("versioningEnabled") Boolean versioningEnabled,
@QueryParam("include") List<String> include, @QueryParam("include") List<String> include,
@QueryParam("fields") List<String> fields, @QueryParam("fields") List<String> fields,
List<Attachment> attachments); @Multipart(value = "filedata", required = false) Attachment attachment);
} }

View File

@ -9,6 +9,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam; import org.glassfish.jersey.media.multipart.FormDataParam;
@ -28,8 +29,8 @@ public interface NodesJerseyApi {
@POST @POST
@Path("/nodes/{nodeId}/children") @Path("/nodes/{nodeId}/children")
@Consumes({ "application/json", "multipart/form-data" }) @Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ "application/json" }) @Produces({ MediaType.APPLICATION_JSON })
@ApiOperation(value = "Create a node", tags={ }) @ApiOperation(value = "Create a node", tags={ })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class), @ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class),