@Override public UriBuilder port(int port) { checkSsp(); if (port < -1) // -1 is used to reset port setting and since URI allows // as port any positive integer, so do we. { throw new IllegalArgumentException("Invalid port value"); } this.port = port; return this; }
@Override public UriBuilder port(int port) { checkSsp(); if (port < -1) // -1 is used to reset port setting and since URI allows // as port any positive integer, so do we. { throw new IllegalArgumentException("Invalid port value"); } this.port = port; return this; }
@Override public UriBuilder path(String path) { checkSsp(); appendPath(path); return this; }
@Override public UriBuilder segment(String... segments) throws IllegalArgumentException { checkSsp(); if (segments == null) { throw new IllegalArgumentException("Segments parameter is null"); } for (String segment : segments) { appendPath(segment, true); } return this; }
@Override public UriBuilder userInfo(String ui) { checkSsp(); this.userInfo = (ui != null) ? encode(ui, UriComponent.Type.USER_INFO) : null; return this; }
@Override public UriBuilder userInfo(String ui) { checkSsp(); this.userInfo = (ui != null) ? encode(ui, UriComponent.Type.USER_INFO) : null; return this; }
@Override public UriBuilder replacePath(String path) { checkSsp(); this.path.setLength(0); if (path != null) { appendPath(path); } return this; }
@Override public UriBuilder replacePath(String path) { checkSsp(); this.path.setLength(0); if (path != null) { appendPath(path); } return this; }
@Override public UriBuilder path(String path) { checkSsp(); appendPath(path); return this; }
@Override public UriBuilder replaceQuery(String query) { checkSsp(); this.query.setLength(0); if (query != null) { this.query.append(encode(query, UriComponent.Type.QUERY)); } return this; }
@Override public UriBuilder host(String host) { checkSsp(); if (host != null) { if (host.length() == 0) // null is used to reset host setting { throw new IllegalArgumentException("Invalid host name"); } this.host = encode(host, UriComponent.Type.HOST); } else { this.host = null; } return this; }
@Override public UriBuilder segment(String... segments) throws IllegalArgumentException { checkSsp(); if (segments == null) { throw new IllegalArgumentException("Segments parameter is null"); } for (String segment : segments) { appendPath(segment, true); } return this; }
@Override public UriBuilder replaceQuery(String query) { checkSsp(); this.query.setLength(0); if (query != null) { this.query.append(encode(query, UriComponent.Type.QUERY)); } return this; }
@Override public UriBuilder host(String host) { checkSsp(); if (host != null) { if (host.length() == 0) // null is used to reset host setting { throw new IllegalArgumentException("Invalid host name"); } this.host = encode(host, UriComponent.Type.HOST); } else { this.host = null; } return this; }
@Override public UriBuilder path(Class resource) { checkSsp(); if (resource == null) { throw new IllegalArgumentException("Resource parameter is null"); } Class<?> c = resource; Path p = c.getAnnotation(Path.class); if (p == null) { throw new IllegalArgumentException("The class, " + resource + " is not annotated with @Path"); } appendPath(p); return this; }
@Override public UriBuilder path(Class resource) { checkSsp(); if (resource == null) { throw new IllegalArgumentException("Resource parameter is null"); } Class<?> c = resource; Path p = c.getAnnotation(Path.class); if (p == null) { throw new IllegalArgumentException("The class, " + resource + " is not annotated with @Path"); } appendPath(p); return this; }
@Override public UriBuilder replaceMatrix(String matrix) { checkSsp(); int i = path.lastIndexOf("/"); if (i != -1) { i = 0; } i = path.indexOf(";", i); if (i != -1) { path.setLength(i + 1); } else { path.append(';'); } if (matrix != null) { path.append(encode(matrix, UriComponent.Type.PATH)); } return this; }
@Override public UriBuilder replaceMatrix(String matrix) { checkSsp(); int i = path.lastIndexOf("/"); if (i != -1) { i = 0; } i = path.indexOf(";", i); if (i != -1) { path.setLength(i + 1); } else { path.append(';'); } if (matrix != null) { path.append(encode(matrix, UriComponent.Type.PATH)); } return this; }
@Override public UriBuilder path(Method method) { checkSsp(); if (method == null) { throw new IllegalArgumentException("Method is null"); } appendPath(getPath(method)); return this; }
@Override public UriBuilder path(Method method) { checkSsp(); if (method == null) { throw new IllegalArgumentException("Method is null"); } appendPath(getPath(method)); return this; }