private URI getRequestUri(final Request request, final URI baseUri) { try { final String serverAddress = getServerAddress(baseUri); String uri = ContainerUtils.getHandlerPath(request.getTarget()); final String queryString = request.getQuery().toString(); if (queryString != null) { uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString); } return new URI(serverAddress + uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
/** * This method is used to acquire the query part from the HTTP * request URI target and a form post if it exists. Both the * query and the form post are merge together in a single query. * * @return the query associated with the HTTP target URI */ public Query getQuery() { return request.getQuery(); }
/** * This method is used to acquire the query part from the HTTP * request URI target and a form post if it exists. Both the * query and the form post are merge together in a single query. * * @return the query associated with the HTTP target URI */ public Query getQuery() { return request.getQuery(); }
/** * This method is used to acquire the query part from the HTTP * request URI target and a form post if it exists. Both the * query and the form post are merge together in a single query. * * @return the query associated with the HTTP target URI */ public Query getQuery() { return request.getQuery(); }
@Override public List<String> getQueryParams(String param) { List<String> queryParams = request.getQuery().getAll(param); return queryParams==null?null:Lists.newArrayList(queryParams); }
@Override public Optional<String> getQueryParam(String param) { return Optional.fromNullable(request.getQuery().get(param)); }
@Override public List<String> getQueryParams(String param) { List<String> queryParams = request.getQuery().getAll(param); return queryParams==null?null:Lists.newArrayList(queryParams); }
@Override public Query query() { return new SimpleQuery(request.getQuery()); }
@Override public Optional<String> getQueryParam(String param) { return Optional.fromNullable(request.getQuery().get(param)); }
public Set<String> getRequestParameterNames() { return request.getQuery().keySet(); }
public String getQuery() { return request.getQuery().toString(); }
@Override public ImmutableMap<String, ImmutableList<String>> getQueryParams() { if (queryParams == null) { ImmutableMap.Builder<String, ImmutableList<String>> paramsBuilder = ImmutableMap.builder(); Query query = request.getQuery(); for (String param : query.keySet()) { paramsBuilder.put(param, ImmutableList.copyOf(query.getAll(param))); } queryParams = paramsBuilder.build(); } return queryParams; }
@Override public ImmutableMap<String, ImmutableList<String>> getQueryParams() { if (queryParams == null) { ImmutableMap.Builder<String, ImmutableList<String>> paramsBuilder = ImmutableMap.builder(); Query query = request.getQuery(); for (String param : query.keySet()) { paramsBuilder.put(param, ImmutableList.copyOf(query.getAll(param))); } queryParams = paramsBuilder.build(); } return queryParams; }
private URI getRequestUri(final Request request, final URI baseUri) { try { final String serverAddress = getServerAddress(baseUri); String uri = ContainerUtils.getHandlerPath(request.getTarget()); final String queryString = request.getQuery().toString(); if (queryString != null) { uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString); } return new URI(serverAddress + uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
@Override public void parseRequestParameters(Map<String, String> params, Map<String, FileItem> files) throws RequestParseException { Map map = baseRequest.getQuery(); params.putAll(map);
public static FullHttpRequest convert(final Request request) { byte[] data = null; try { final InputStream inputStream = request.getInputStream(); try { data = IOUtils.toByteArray(inputStream); } finally { inputStream.close(); } } catch (final IOException e) { LOGGER.error("IOException when getting request content.", e); } final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl(); httpRequest.domain(request.getAddress().getDomain()); httpRequest.port(request.getAddress().getPort()); httpRequest.method(Method.valueOf(request.getMethod())); httpRequest.path(request.getPath().getPath()); if (data.length > 0) { httpRequest.content(data); } for (final String headerField : request.getNames()) { for (final String headerFieldValue : request.getValues(headerField)) { httpRequest.httpMessageHeader(headerField, headerFieldValue); } } for (final Entry<String, String> entry : request.getQuery().entrySet()) { httpRequest.queryParameter(entry.getKey(), entry.getValue()); } return httpRequest; }