Skip to content

Leverage Spring Data REST's link building utility #28

Description

@gregturn

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions