private RequestParameter parse(int from, int to) { int pos = Tools.indexOf(s, '=', from, to); if (pos == -1) { String name = s.subSequence(from, to).toString(); String decodeName = safeDecodeName(name); if (decodeName != null) { return RequestParameter.create(decodeName, ""); } } else if (pos > 0) { String value = s.subSequence(pos + 1, to).toString(); String decodedValue = safeDecodeValue(value); if (decodedValue != null) { String name = s.subSequence(from, pos).toString(); String decodedName = safeDecodeName(name); if (decodedName != null) { return RequestParameter.create(decodedName, value, decodedValue); } } } return null; }
private RequestParameter parse(int from, int to) { int pos = Tools.indexOf(s, '=', from, to); if (pos == -1) { String name = s.subSequence(from, to).toString(); String decodeName = safeDecodeName(name); if (decodeName != null) { return RequestParameter.create(decodeName, ""); } } else if (pos > 0) { String value = s.subSequence(pos + 1, to).toString(); String decodedValue = safeDecodeValue(value); if (decodedValue != null) { String name = s.subSequence(from, pos).toString(); String decodedName = safeDecodeName(name); if (decodedName != null) { return RequestParameter.create(decodedName, value, decodedValue); } } } return null; }
requestParameters = new HashMap<String, RequestParameter>(); requestParameters.put(name, RequestParameter.create(parameter));
PortletRequestBridge(Bridge bridge, Phase phase, Rq req, Rs resp, PortletConfig config, ControllerHandler<?> target, Map<String, String[]> parameters) { // Map<String, RequestParameter> requestParameters = Collections.emptyMap(); for (Map.Entry<String, String[]> parameter : parameters.entrySet()) { if (requestParameters.isEmpty()) { requestParameters = new HashMap<String, RequestParameter>(); } RequestParameter.create(parameter).appendTo(requestParameters); } // this.phase = phase; this.bridge = bridge; this.req = req; this.resp = resp; this.target = target; this.requestParameters = requestParameters; this.httpContext = new PortletHttpContext(req); this.securityContext = new PortletSecurityContext(req); this.windowContext = new PortletWindowContext(this); this.userContext = new PortletUserContext(req); this.applicationContext = new PortletApplicationContext(config); }
PortletRequestBridge(Bridge bridge, Phase phase, Rq req, Rs resp, PortletConfig config, ControllerHandler<?> target, Map<String, String[]> parameters) { // Map<String, RequestParameter> requestParameters = Collections.emptyMap(); for (Map.Entry<String, String[]> parameter : parameters.entrySet()) { if (requestParameters.isEmpty()) { requestParameters = new HashMap<String, RequestParameter>(); } RequestParameter.create(parameter).appendTo(requestParameters); } // this.phase = phase; this.bridge = bridge; this.req = req; this.resp = resp; this.target = target; this.requestParameters = requestParameters; this.httpContext = new PortletHttpContext(req); this.securityContext = new PortletSecurityContext(req); this.windowContext = new PortletWindowContext(this); this.userContext = new PortletUserContext(req); this.applicationContext = new PortletApplicationContext(config); }
RequestParameter parameterArg = parameterArguments.get(name); if (parameterArg == null) { parameterArguments.put(name, RequestParameter.create(name, file.getString())); } else { parameterArguments.put(name, parameterArg.append(new String[]{file.getString()}));
requestParameters = new HashMap<String, RequestParameter>(); requestParameters.put(name, RequestParameter.create(parameter));
@Test public void testCreateIAE() { try { RequestParameter.create("a", new String[0]); fail(); RequestParameter.create("a", new String[]{null}); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>(null, new String[]{"a"})); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("a", null)); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("", new String[0])); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("", new String[]{null})); fail();
@Test public void testCreateIAE() { try { RequestParameter.create("a", new String[0]); fail(); RequestParameter.create("a", new String[]{null}); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>(null, new String[]{"a"})); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("a", null)); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("", new String[0])); fail(); RequestParameter.create(new AbstractMap.SimpleEntry<String, String[]>("", new String[]{null})); fail();
@Test public void testCreateNPE() { try { RequestParameter.create(null); fail(); RequestParameter.create(null, "a"); fail(); RequestParameter.create("a", (String)null); fail(); RequestParameter.create(null, "a", "a"); fail(); RequestParameter.create("a", "a", null); fail(); RequestParameter.create(null, new String[]{"a"}); fail(); RequestParameter.create("a", (String[])null); fail();
@Test public void testCreateNPE() { try { RequestParameter.create(null); fail(); RequestParameter.create(null, "a"); fail(); RequestParameter.create("a", (String)null); fail(); RequestParameter.create(null, "a", "a"); fail(); RequestParameter.create("a", "a", null); fail(); RequestParameter.create(null, new String[]{"a"}); fail(); RequestParameter.create("a", (String[])null); fail();
public MockRequestBridge(ApplicationRuntime<?, ?> application, MockClient client, Phase phase, MethodHandle target, Map<String, String[]> parameters) { // Map<String, RequestParameter> requestParameters = Collections.emptyMap(); for (Map.Entry<String, String[]> parameter : parameters.entrySet()) { if (requestParameters.isEmpty()) { requestParameters = new HashMap<String, RequestParameter>(); } RequestParameter.create(parameter).appendTo(requestParameters); } // ServletScopedContext attributes = new ServletScopedContext(Logger.SYSTEM) { @Override public void close() { attributesHistory.addAll(Tools.list(MockRequestBridge.this.attributes)); super.close(); } }; // this.application = application; this.client = client; this.target = target; this.attributes = attributes; this.httpContext = new MockHttpContext(); this.securityContext = new MockSecurityContext(client); this.windowContext = new MockWindowContext(); this.attributesHistory = new ArrayList<Scoped>(); this.requestParameters = requestParameters; this.phase = phase; }
public MockRequestBridge(ApplicationRuntime<?, ?> application, MockClient client, Phase phase, MethodHandle target, Map<String, String[]> parameters) { // Map<String, RequestParameter> requestParameters = Collections.emptyMap(); for (Map.Entry<String, String[]> parameter : parameters.entrySet()) { if (requestParameters.isEmpty()) { requestParameters = new HashMap<String, RequestParameter>(); } RequestParameter.create(parameter).appendTo(requestParameters); } // ServletScopedContext attributes = new ServletScopedContext(Logger.SYSTEM) { @Override public void close() { attributesHistory.addAll(Tools.list(MockRequestBridge.this.attributes)); super.close(); } }; // this.application = application; this.client = client; this.target = target; this.attributes = attributes; this.httpContext = new MockHttpContext(); this.securityContext = new MockSecurityContext(client); this.windowContext = new MockWindowContext(); this.attributesHistory = new ArrayList<Scoped>(); this.requestParameters = requestParameters; this.phase = phase; }
RequestParameter requestParameter = RequestParameter.create(entry.getKey().getName(), entry.getValue()); requestParameters.put(requestParameter.getName(), requestParameter);
RequestParameter requestParameter = RequestParameter.create(entry.getKey().getName(), entry.getValue()); requestParameters.put(requestParameter.getName(), requestParameter);
rp = new HashMap<String, RequestParameter>(); RequestParameter requestParameter = RequestParameter.create(parameter.getName(), parameter.toArray()); rp.put(requestParameter.getName(), requestParameter);
rp = new HashMap<String, RequestParameter>(); RequestParameter requestParameter = RequestParameter.create(parameter.getName(), parameter.toArray()); rp.put(requestParameter.getName(), requestParameter);