Skip to content
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

add support for relative upload paths in DataStoreService #23

Merged
merged 1 commit into from
Oct 16, 2014

Conversation

jimirocks
Copy link
Contributor

No description provided.

sardine = new SardineImpl(httClientBuilder, user, pass);
}

private UriPrefixer getPrefixer() {
if (prefixer == null) {
final String webDAVUri = gdcService.getGdc().getLink("uploads").getLink();
prefixer = new UriPrefixer(webDAVUri);
final String uriPrefix = StringUtils.isEmpty(URI.create(webDAVUri).getHost()) ? gdcHost + webDAVUri : webDAVUri;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about protocol?

@martiner
Copy link
Contributor

Maybe we should use HttpClient's UriBuilder because the current implementation doesn't handle paths well: storeService.upload("test", stream); (not the missing leading slash)

@jimirocks
Copy link
Contributor Author

I would go for UriBuilder, thanks !

@jimirocks
Copy link
Contributor Author

well it seems UriBuilder can't bring anything useful, however here is the solution handling slahes corectly + test

initJadler();

gdcService = mock(GdcService.class);
storeService = new DataStoreService(HttpClientBuilder.create(), gdcService, "http://localhost:"+port(), "user", "pass");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably the port should be passed as an argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefere not, the DataStoreService doesn't need to know about gdc uri structure, it only needs to know whole uri to prefix the uploads when needed. I will rename the contructor argument and create it more correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataStoreServiceTest changed to integration test (DataStoreServiceIT)

@jimirocks jimirocks force-pushed the jmi-uploads branch 4 times, most recently from 734b64e to d7f29ab Compare September 9, 2014 09:01
@martiner
Copy link
Contributor

martiner commented Oct 7, 2014

one last thing: please write the commit message in the imperative mood

@jimirocks jimirocks changed the title DataStoreService works also with relative uploads path add support for relative uplaod paths in DataStoreService Oct 13, 2014
the link to uploads in Gdc, can be relative when the host is the same as gdcHost,
added fallback to complete the relative path with gdcHost uri
@jimirocks jimirocks changed the title add support for relative uplaod paths in DataStoreService add support for relative upload paths in DataStoreService Oct 13, 2014
@jimirocks
Copy link
Contributor Author

commit message is now in the imperative mood

@martiner martiner added this to the 0.10 milestone Oct 16, 2014
martiner added a commit that referenced this pull request Oct 16, 2014
add support for relative upload paths in DataStoreService
@martiner martiner merged commit b8f270c into master Oct 16, 2014
@martiner martiner deleted the jmi-uploads branch October 16, 2014 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants