/** * Follow link by REL. * @param rel Relation name * @return The same object * @throws IOException If fails */ public Request follow(final String rel) throws IOException { final WebLinkingResponse.Link link = this.links().get(rel); if (link == null) { throw new IOException( String.format( "Link with rel=\"%s\" doesn't exist, use #hasLink()", rel ) ); } return new RestResponse(this).jump(link.uri()); }
/** * Follow XML link. * @param query XPath query to fetch new URI * @return New request */ public Request rel(final String query) { this.assertXPath(query); return new RestResponse(this).jump( URI.create(this.xml().xpath(query).get(0)) ); }