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

Leverage Spring Data REST's link building utility #28

Open
gregturn opened this issue Aug 28, 2019 · 0 comments
Open

Leverage Spring Data REST's link building utility #28

gregturn opened this issue Aug 28, 2019 · 0 comments

Comments

@gregturn
Copy link
Contributor

gregturn commented Aug 28, 2019

Current, we have to do stuff like this to mesh a custom controller with a Spring Data REST one.

private static Link applyBasePath(Link link, String basePath) {

	URI uri = link.toUri();

	URI newUri = null;
	try {
		newUri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), //
				uri.getPort(), basePath + uri.getPath(), uri.getQuery(), uri.getFragment());
	} catch (URISyntaxException e) {
		e.printStackTrace();
	}

	return new Link(newUri.toString(), link.getRel());
}

Take advantage of DATAREST-1423 to simplify the integration.

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

No branches or pull requests

1 participant