-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ALFREDAPI-568 Separated upload to native Alfresco webscript as a workaround to broken multipart upload with Alfresco MVC #238
Open
todorinskiz
wants to merge
5
commits into
master
Choose a base branch
from
ALFREDAPI-568
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d56a3c3
ALFREDAPI-568 Separated upload to native Alfresco webscript as a work…
todorinskiz 0af2a16
ALFREDAPI-568 Updated CHANGELOG.md
todorinskiz b325178
ALFREDAPI-568 copy exception handling logic
maartenboonen-xenit 407d487
ALFREDAPI-568 test standard Alfresco upload keeps working
maartenboonen-xenit fa0f568
ALFREDAPI-568 also move PUT node content to separate webscript + fixes
maartenboonen-xenit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,4 +135,4 @@ public boolean isMultipart(HttpServletRequest request) { | |
} | ||
}; | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
alfred-api-rest/src/main/java/eu/xenit/alfred/api/rest/jackson/ObjectMapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package eu.xenit.alfred.api.rest.jackson; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.JsonSerializer; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import eu.xenit.alfred.api.search.json.SearchNodeJsonParser; | ||
import org.alfresco.rest.framework.jacksonextensions.RestJsonModule; | ||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | ||
|
||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.TimeZone; | ||
|
||
public class ObjectMapperFactory { | ||
public static ObjectMapper getNewObjectMapper(RestJsonModule alfrescoRestJsonModule) { | ||
ObjectMapper om = new SearchNodeJsonParser().getObjectMapper(); | ||
om.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
jackson2ObjectMapperBuilder(alfrescoRestJsonModule).configure(om); | ||
return om; | ||
} | ||
|
||
private static Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder(RestJsonModule alfrescoRestJsonModule) { | ||
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json().failOnEmptyBeans(false) | ||
.failOnUnknownProperties(false).dateFormat(dateFormat()) | ||
.serializers(customJsonSerilizers().toArray(new JsonSerializer[0])) | ||
.deserializers(customJsonDeserializers().toArray(new JsonDeserializer[0])) | ||
.featuresToEnable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) | ||
.findModulesViaServiceLoader(true); | ||
|
||
if (alfrescoRestJsonModule != null) { | ||
builder.modulesToInstall(alfrescoRestJsonModule); | ||
} | ||
|
||
return builder; | ||
} | ||
|
||
private static DateFormat dateFormat() { | ||
DateFormat dateFormatIso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); | ||
dateFormatIso8601.setTimeZone(TimeZone.getTimeZone("UTC")); | ||
return dateFormatIso8601; | ||
} | ||
|
||
private static List<JsonDeserializer<?>> customJsonDeserializers() { | ||
return Arrays.asList( | ||
new Jackson2AlfredApiNodeRefDeserializer(), | ||
new Jackson2AlfredApiQnameDeserializer() | ||
); | ||
} | ||
|
||
private static List<JsonSerializer<?>> customJsonSerilizers() { | ||
maartenboonen-xenit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return Arrays.asList( | ||
new Jackson2AlfredApiNodeRefSerializer(), | ||
new Jackson2AlfredApiQnameSerializer() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move configureObjectMapper from SearchNodeJsonParser to this class and call ObjectMapperFactory from SearchNodeJsonParser instead?