Refine search
/** * Gets the values of template variables * * @return map of value indexed by variable name (or the empty map) */ public Map<String, String> getTemplateArgs() { Map<String, String> args = req.getServiceMatch().getTemplateVars(); return (args == null) ? emptyArgs : args; } }
while(rs.next()){ match = new Match(); match.setBlabla(rs.get(value)); ....all sets list.add(match); }
/** * Gets the matching service path * * e.g. * a) service registered path = /search/engine * b) request path = /search/engine/external * * => /search/engine * * @return matching path */ public String getMatch() { return req.getServiceMatch().getPath(); }
Firebase ref = new Firebase(FIREBASE_URL); ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { Map<String, Object> objectMap = (HashMap<String, Object>) dataSnapshot.getValue(); List<Match> = new ArrayList<Match>(); for (Object obj : objectMap.values()) { if (obj instanceof Map) { Map<String, Object> mapObj = (Map<String, Object>) obj; Match match = new Match(); match.setSport((String) mapObj.get(Constants.SPORT)); match.setPlayingWith((String) mapObj.get(Constants.PLAYER)); list.add(match); } } } @Override public void onCancelled(FirebaseError firebaseError) { } });
StatusTemplate statusTemplate = null; Map<String, Object> statusModel = null; String format = request.getFormat(); statusCode = we.getStatus(); statusTemplate = we.getStatusTemplate(); statusModel = we.getStatusModel(); statusModel.putAll(container.getTemplateParameters()); statusModel.put("url", createURLModel(request)); if (match != null && match.getWebScript() != null) statusModel.put("webscript", match.getWebScript().getDescription()); String mimetype = container.getFormatRegistry().getMimeType(request.getAgent(), statusTemplate.getFormat()); if (mimetype == null) logger.debug("Force success status header in response: " + request.forceSuccessStatus()); logger.debug("Sending status " + statusCode + " (Template: " + statusTemplate.getPath() + ")"); logger.debug("Rendering response: content type=" + mimetype);
params.put("webscript", req.getServiceMatch().getWebScript().getDescription()); params.put("format", new FormatModel(container.getFormatRegistry(), req.getFormat())); params.put("args", createArgs(req)); params.put("argsM", createArgsM(req)); params.put("headers", createHeaders(req)); params.put("headersM", createHeadersM(req)); params.put("guest", req.isGuest()); params.put("url", createURLModel(req)); params.put("msg", getScriptMessage());
params.putAll(req.getRuntime().getTemplateParameters()); params.putAll(container.getTemplateParameters()); params.put("webscript", req.getServiceMatch().getWebScript().getDescription()); params.put("format", new FormatModel(container.getFormatRegistry(), req.getFormat())); params.put("args", createArgs(req)); params.put("argsM", createArgsM(req));
if (scriptUrl == null || scriptUrl.length() == 0) throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Script URL not specified"); if ((match != null) && (match.getWebScript().getDescription().getRequiredAuthentication().equals(RequiredAuthentication.none))) if (match == null || match.getKind() == Match.Kind.URI) throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, msg); throw new WebScriptException(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg); if (debug) logger.debug("Agent: " + scriptReq.getAgent()); final WebScript script = match.getWebScript(); final Description description = script.getDescription(); String reqFormat = scriptReq.getFormat(); String format = (reqFormat == null || reqFormat.length() == 0) ? "[undefined]" : reqFormat; Description desc = scriptReq.getServiceMatch().getWebScript().getDescription(); logger.debug("Invoking Web Script " + description.getId() + " (format " + format + ", style: " + desc.getFormatStyle() + ", default: " + desc.getDefaultFormat() + ")");
if (match != null && match.getKind() != Match.Kind.URI) Description desc = match.getWebScript().getDescription(); FormatStyle style = desc.getFormatStyle(); throw new WebScriptException("Format specified both in extension and format argument"); if (format == null) throw new WebScriptException(HttpServletResponse.SC_NOT_ACCEPTABLE, "Cannot negotiate appropriate response format for Accept: " + accept);
public void executeScript(WebScriptRequest scriptReq, WebScriptResponse scriptRes, Authenticator auth) throws IOException { // Handle authentication of scripts on a case-by-case basis. // Currently we assume that if a webscript servlet has any authenticator // applied then it must be for some kind of remote user auth as supplied. WebScript script = scriptReq.getServiceMatch().getWebScript(); script.setURLModelFactory(getUrlModelFactory()); Description desc = script.getDescription(); RequiredAuthentication required = desc.getRequiredAuthentication(); if (auth == null || RequiredAuthentication.none == required || auth.authenticate(required, false)) { script.execute(scriptReq, scriptRes); } }
if (serviceMatch != null && serviceMatch.getWebScript().getDescription().getMultipartProcessing())
@Override protected void executeScript(WebScriptRequest scriptReq, WebScriptResponse scriptRes, Authenticator auth) throws IOException { // Set Portlet title based on Web Script WebScript script = scriptReq.getServiceMatch().getWebScript(); Description desc = script.getDescription(); res.setTitle(desc.getShortName()); // Note: Do not render script if portlet window is minimized if (!WindowState.MINIMIZED.equals(req.getWindowState())) { super.executeScript(scriptReq, scriptRes, auth); } }
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars(); String packagePath = "/" + templateVars.get("package"); if (path == null) throw new WebScriptException(Status.STATUS_NOT_FOUND, "Web Script Package '" + packagePath + "' not found"); if (packageDoc == null) throw new WebScriptException(Status.STATUS_NOT_FOUND, "Web Script documentation for package '" + packagePath + "' not found"); for (WebScript webscript : webscripts) TypeDescription[] requests = webscript.getDescription().getRequestTypes(); if (requests != null) TypeDescription[] responses = webscript.getDescription().getResponseTypes(); if (responses != null)
if (match != null) if (match.getKind() == Match.Kind.URI) WebScript webScript = match.getWebScript(); if (webScript != null) String path = webScript.getDescription().getId() + ".head"; templateProcessor.process(validTemplatePath, model, writer); context.updateExtendingModuleDependencies(webScript.getDescription().getId(), model);
clazzAndMethod = req.getServiceMatch().getTemplateVars().get("clazz"); if (clazzAndMethod == null) { clazzAndMethod = req.getParameter("clazz");
currentMatch.setTeam1(builder.toString()); else if (qName.equalsIgnoreCase("team2")) currentMatch.setTeam2(builder.toString()); else if (qName.equalsIgnoreCase("resultfinal")) currentMatch.setResultfinal(builder.toString()); else if (qName.equalsIgnoreCase("result1")) currentMatch.setResult1(builder.toString()); else if (qName.equalsIgnoreCase("result2")) currentMatch.setResult2(builder.toString()); else if (qName.equalsIgnoreCase("venue")) currentMatch.setVenue(builder.toString()); else if (qName.equalsIgnoreCase("gmt")) currentMatch.setGmt(builder.toString()); else if (qName.equals("match")) currentDay.add(currentMatch); currentMatch = new Match();
/** * Gets the template form of this path * * @return template form of path */ public String getTemplate() { return req.getServiceMatch().getTemplate(); }
/** * Helper to get the List of supported methods for web script. * For responding to OPTIONS requests. * * @return List of supported methods for web script */ public List<HttpMethod> getSupportedMethods() { final HttpMethod[] methods = HttpMethod.values(); List<HttpMethod> supportedMethods = new ArrayList<HttpMethod>(methods.length); Match match = null; for (int i = 0; i < methods.length; i++) { match = container.getRegistry().findWebScript(methods[i].name(), getScriptUrl()); if (match.getKind().equals(Match.Kind.FULL)) { supportedMethods.add(methods[i]); } } return supportedMethods; } }
for (final String keyword : keywords) { if (text.contains(keyword)) { results.add(new Match(text, keyword)); System.out.println(match.getOriginalText() + " ; keyword found:" + match.getKeyword());