use of org.springframework.web.util.UriComponents in project libresonic by Libresonic.
the class JWTSecurityService method createToken.
private static String createToken(String jwtKey, String path, Date expireDate) {
UriComponents components = UriComponentsBuilder.fromUriString(path).build();
String query = components.getQuery();
String claim = components.getPath() + (!StringUtils.isBlank(query) ? "?" + components.getQuery() : "");
logger.debug("Creating token with claim " + claim);
return JWT.create().withClaim(CLAIM_PATH, claim).withExpiresAt(expireDate).sign(getAlgorithm(jwtKey));
}
use of org.springframework.web.util.UriComponents in project java-chassis by ServiceComb.
the class CseUriTemplateHandler method expandInternal.
@Override
protected URI expandInternal(String uriTemplate, Object... uriVariables) {
UriComponentsBuilder uriComponentsBuilder = initUriComponentsBuilder(uriTemplate);
UriComponents uriComponents = expandAndEncode(uriComponentsBuilder, uriVariables);
return createUri(uriTemplate, uriComponentsBuilder, uriComponents);
}
use of org.springframework.web.util.UriComponents in project java-chassis by ServiceComb.
the class CseUriTemplateHandler method expandInternal.
@Override
protected URI expandInternal(String uriTemplate, Map<String, ?> uriVariables) {
UriComponentsBuilder uriComponentsBuilder = initUriComponentsBuilder(uriTemplate);
UriComponents uriComponents = expandAndEncode(uriComponentsBuilder, uriVariables);
return createUri(uriTemplate, uriComponentsBuilder, uriComponents);
}
use of org.springframework.web.util.UriComponents in project cuba by cuba-platform.
the class EntitiesController method createEntity.
@PostMapping("/{entityName}")
public ResponseEntity<String> createEntity(@RequestBody String entityJson, @PathVariable String entityName, @RequestParam(required = false) String modelVersion, HttpServletRequest request) {
CreatedEntityInfo entityInfo = entitiesControllerManager.createEntity(entityJson, entityName, modelVersion);
UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl(request.getRequestURL().toString()).path("/{id}").buildAndExpand(entityInfo.getId().toString());
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setLocation(uriComponents.toUri());
return new ResponseEntity<>(entityInfo.getJson(), httpHeaders, HttpStatus.CREATED);
}
use of org.springframework.web.util.UriComponents in project spring-data-commons by spring-projects.
the class HateoasPageableHandlerMethodArgumentResolverUnitTests method assertTemplateEnrichment.
private void assertTemplateEnrichment(String baseUri, String expected) {
UriComponents uriComponents = UriComponentsBuilder.fromUriString(baseUri).build();
HateoasPageableHandlerMethodArgumentResolver resolver = getResolver();
assertThat(resolver.getPaginationTemplateVariables(null, uriComponents).toString()).isEqualTo(expected);
}
Aggregations