public int size() { int size = 0; if (this.jaxRsRespHeaders != null) { size = this.jaxRsRespHeaders.size(); } final Series<Header> headers = getHeaders(); if (headers != null) { size += headers.size(); } return size; }
/** * URL encodes the form. * * @param separator * The separator character to append between parameters. * @param queryString * True if the target is a query string. * @return The encoded form. * @throws IOException */ public String encode(char separator, boolean queryString) throws IOException { StringBuilder sb = new StringBuilder(); for (int i = 0; i < getEntries().size(); i++) { if (i > 0) { sb.append(separator); } getEntries().get(i).encode(sb, queryString); } return sb.toString(); }
@Override public Cookie getCookie(String name) { if (getTarget().getCookies().size() > 0) { for (org.restlet.data.Cookie cookie : getTarget().getCookies()) { if (cookie.getName().equals(name)) { return new CookieAdapter(cookie); } } } return null; }
for (int i = 0; i < parameters.size(); i++) { Parameter p = parameters.get(i); hw.appendParameterSeparator();
/** * {@inheritDoc}<br> * In case the media type has parameters, this method returns the * concatenation of the main type and the subtype. If the subtype is not * equal to "*", it returns the concatenation of the main type and "*". * Otherwise, it returns either the {@link #ALL} media type if it is already * the {@link #ALL} media type, or null. */ @Override public MediaType getParent() { MediaType result = null; if (getParameters().size() > 0) { result = MediaType.valueOf(getMainType() + "/" + getSubType()); } else { if (getSubType().equals("*")) { result = equals(ALL) ? null : ALL; } else { result = MediaType.valueOf(getMainType() + "/*"); } } return result; }
/** * {@inheritDoc}<br> * In case the media type has parameters, this method returns the * concatenation of the main type and the subtype. If the subtype is not * equal to "*", it returns the concatenation of the main type and "*". * Otherwise, it returns either the {@link #ALL} media type if it is already * the {@link #ALL} media type, or null. */ @Override public MediaType getParent() { MediaType result = null; if (getParameters().size() > 0) { result = MediaType.valueOf(getMainType() + "/" + getSubType()); } else { if (getSubType().equals("*")) { result = equals(ALL) ? null : ALL; } else { result = MediaType.valueOf(getMainType() + "/*"); } } return result; }
for (int i = 0; result && i < getParameters().size(); i++) { Parameter param = getParameters().get(i); Parameter includedParam = includedMediaType
for (int i = 0; result && i < getParameters().size(); i++) { Parameter param = getParameters().get(i); Parameter includedParam = includedMediaType
/** * Test method for {@link org.restlet.security.Realm#getParameters()}. */ @Test public final void testGetParameters() { Assert.assertNotNull(this.testRealm.getParameters()); Assert.assertEquals(0, this.testRealm.getParameters().size()); }
/** * Test method for {@link org.restlet.security.Realm#setParameters(org.restlet.util.Series)}. */ @Test public final void testSetParameters() { Assert.assertEquals(0, this.testRealm.getParameters().size()); final List<Parameter> list = new ArrayList<Parameter>(1); list.add(new Parameter("testName", "123")); this.testRealm.setParameters(new Series<Parameter>(Parameter.class, list)); Assert.assertEquals(1, this.testRealm.getParameters().size()); final Parameter parameter = this.testRealm.getParameters().get(0); Assert.assertEquals("testName", parameter.getName()); Assert.assertEquals("123", parameter.getValue()); }