fixing multipart handling for APS deploy
This commit is contained in:
parent
21def1483b
commit
cf051cac8a
2
pom.xml
2
pom.xml
@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>com.inteligr8.alfresco</groupId>
|
||||
<artifactId>aps-public-rest-api</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.3</version>
|
||||
<classifier>aps1</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -4,19 +4,17 @@ import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.file.StreamDataBodyPart;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl;
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
|
||||
import com.inteligr8.alfresco.activiti.model.FileMultipartJersey;
|
||||
|
||||
@Mojo( name = "deploy-app", threadSafe = true )
|
||||
@Component( role = org.apache.maven.plugin.Mojo.class )
|
||||
@ -29,7 +27,6 @@ public class DeployAppGoal extends ApsAppAccessibleGoal {
|
||||
protected boolean publish = false;
|
||||
|
||||
protected final int bufferSize = 128 * 1024;
|
||||
private final MediaType zipMediaType = MediaType.valueOf("application/zip");
|
||||
|
||||
@Override
|
||||
public void executeEnabled() throws MojoExecutionException, MojoFailureException {
|
||||
@ -68,8 +65,7 @@ public class DeployAppGoal extends ApsAppAccessibleGoal {
|
||||
FileInputStream fistream = new FileInputStream(appZip);
|
||||
BufferedInputStream bistream = new BufferedInputStream(fistream, this.bufferSize);
|
||||
try {
|
||||
FormDataMultiPart multipart = new FormDataMultiPart();
|
||||
multipart.bodyPart(new StreamDataBodyPart("file", bistream, appZip.getName(), this.zipMediaType));
|
||||
FileMultipartJersey multipart = FileMultipartJersey.from(appZip.getName(), bistream);
|
||||
|
||||
if (appId == null) {
|
||||
if (this.publish) {
|
||||
@ -92,6 +88,8 @@ public class DeployAppGoal extends ApsAppAccessibleGoal {
|
||||
api.getAppDefinitionsJerseyApi().importApp(appId, multipart, true);
|
||||
}
|
||||
}
|
||||
} catch (ParseException pe) {
|
||||
throw new MojoExecutionException("The app ZIP could not be wrapped in a multipart", pe);
|
||||
} finally {
|
||||
bistream.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user