@Override public boolean containsPrefix(String prefix) { return localNS.containsKey(prefix) || prefixService.containsPrefix(prefix); }
/** * Get namespace * * @param prefix prefix * @return Response with the mapping, if exists */ @GET @Path("/" + PREFIX_PATTERN) @Produces("application/json") public Response getMapping(@PathParam("prefix") String prefix) { if (prefixService.containsPrefix(prefix)) { Map<String, String> result = new HashMap<>(); result.put(prefix, prefixService.getNamespace(prefix)); return Response.ok().entity(result).build(); } else { log.error("prefix {} mapping not found", prefix); return Response.status(Response.Status.NOT_FOUND).entity("prefix " + prefix + " mapping not found").build(); } }
/** * Get namespace * * @param prefix prefix * @return Response with the mapping, if exists */ @GET @Path("/" + PREFIX_PATTERN) @Produces("application/json") public Response getMapping(@PathParam("prefix") String prefix) { if (prefixService.containsPrefix(prefix)) { Map<String, String> result = new HashMap<>(); result.put(prefix, prefixService.getNamespace(prefix)); return Response.ok().entity(result).build(); } else { log.error("prefix {} mapping not found", prefix); return Response.status(Response.Status.NOT_FOUND).entity("prefix " + prefix + " mapping not found").build(); } }
@GET @Path("/prefix") @Produces(Namespaces.MIME_TYPE_JSON) public Map<String, String> resolvePrefix(@QueryParam("prefix") String prefix, @Context UriInfo info) { final PrefixService prefixService = createLocalPrefixService(info); if (prefixService.containsPrefix(prefix)) return Collections.singletonMap(prefix, prefixService.getNamespace(prefix)); // As a fallback, try prefix.cc if (prefix != null) { final String namespace = prefixCC.getNamespace(prefix); if (namespace != null) return Collections.singletonMap(prefix, namespace); } return Collections.emptyMap(); }
return Collections.emptyList(); } else if (prefixService.containsPrefix(px)) { String resolved = prefixService.getNamespace(px) + (local != null ? local : ""); List<String> suggestions = new ArrayList<String>();