/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
@Override public OEntityId apply(SingleLink link) { return OEntityIds.parse(getServiceRootUri(), link.getUri()); } });
@Override public OEntityId apply(SingleLink link) { return OEntityIds.parse(getServiceRootUri(), link.getUri()); } });
private OEntityId parseRequestUri(HttpHeaders httpHeaders, UriInfo uriInfo, String payload) { FormatParser<SingleLink> parser = FormatParserFactory.getParser(SingleLink.class, httpHeaders.getMediaType(), null); SingleLink link = parser.parse(new StringReader(payload)); return OEntityIds.parse(uriInfo.getBaseUri().toString(), link.getUri()); }
private OEntityId parseRequestUri(HttpHeaders httpHeaders, UriInfo uriInfo, String payload) { FormatParser<SingleLink> parser = FormatParserFactory.getParser(SingleLink.class, httpHeaders.getMediaType(), null); SingleLink link = parser.parse(new StringReader(payload)); return OEntityIds.parse(uriInfo.getBaseUri().toString(), link.getUri()); }