/** * Creates a query from a request * * @param request the HTTP request from which this is created * @param queryProfile the query profile to use for this query, or null if none. */ public Query(HttpRequest request, CompiledQueryProfile queryProfile) { this(request, request.propertyMap(), queryProfile); }
private Map<String, String> requestProperties() { return httpRequest.propertyMap(); }
private void populateProperties() { if (parent == null) { return; } properties.putAll(parent.propertyMap()); }
/** * Validates this query * * @return the reason if it is invalid, null if it is valid */ public String validate() { // Validate the query profile QueryProfileProperties queryProfileProperties = properties().getInstance(QueryProfileProperties.class); if (queryProfileProperties == null) return null; // Valid StringBuilder missingName = new StringBuilder(); if ( ! queryProfileProperties.isComplete(missingName, httpRequest.propertyMap())) return "Incomplete query: Parameter '" + missingName + "' is mandatory in " + queryProfileProperties.getQueryProfile() + " but is not set"; else return null; // is valid }
requestMap.putAll(request.propertyMap()); return request.propertyMap();
@Override @SuppressWarnings("unchecked") public HttpResponse handle(HttpRequest request, ContentChannel channel) { com.yahoo.processing.Request processingRequest = new com.yahoo.processing.Request(); populate("", request.propertyMap(), processingRequest.properties()); populate("context", request.getJDiscRequest().context(), processingRequest.properties()); processingRequest.properties().set(Request.JDISC_REQUEST, request); FreezeListener freezeListener = new FreezeListener(processingRequest, renderers, defaultRenderer, channel, renderingExecutor); processingRequest.properties().set(freezeListenerKey, freezeListener); Chain<COMPONENT> chain = chainRegistry.getComponent(resolveChainId(processingRequest.properties())); if (chain == null) throw new IllegalArgumentException("Chain '" + processingRequest.properties().get("chain") + "' not found"); Execution execution = createExecution(chain, processingRequest); freezeListener.setExecution(execution); Response processingResponse = execution.process(processingRequest); return freezeListener.getHttpResponse(processingResponse); }