Refine search
public String[] getFamilys() { List<String> familys = new ArrayList<String>(4); for (String f : description.getFamilys()) { familys.add(f); } return familys.toArray(new String[familys.size()]); }
public void registerUri(WebScript script, String uri) Description desc = script.getDescription(); wildcard = true; if (desc.getFormatStyle() != Description.FormatStyle.argument) String uriIdx = desc.getMethod() + ":" + uri; if (index.containsKey(uriIdx)) if (!existingService.getDescription().getId().equals(desc.getId())) String msg = "Web Script document " + desc.getDescPath() + " is attempting to define the url '" + uriIdx + "' already defined by " + existingService.getDescription().getDescPath(); throw new WebScriptException(msg);
public String[] getURIs() { return description.getURIs(); }
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))) 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 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() + ")"); logger.debug("Web Script " + description.getId() + " executed in " + (endScript - startScript)/1000000f + "ms");
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))) 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 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() + ")"); logger.debug("Web Script " + description.getId() + " executed in " + (endScript - startScript)/1000000f + "ms");
throw new WebScriptException("Failed to search for package descriptions in store " + apiStore, e); throw new WebScriptException("Failed to read package description document " + apiStore.getBasePath() + packageDescPath, e); throw new WebScriptException("Failed to search for schema descriptions in store " + apiStore, e); Description existingDesc = existingService.getDescription(); String msg = "Web Script description document " + serviceDesc.getStorePath() + "/" + serviceDesc.getDescPath(); msg += " overridden by " + existingDesc.getStorePath() + "/" + existingDesc.getDescPath(); logger.debug(msg); serviceImpl.init(container, serviceDesc); logger.debug("Registered Web Script URL '" + serviceImpl.getDescription().getMethod() + ":" + uriTemplate + "'");
/** * Associate Web Script with Path * * @param script WebScript */ public void addScript(WebScript script) { scripts.put(script.getDescription().getId(), script); }
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"); NegotiatedFormat[] negotiatedFormats = desc.getNegotiatedFormats(); if (accept != null && negotiatedFormats != null) if (format == null) throw new WebScriptException(HttpServletResponse.SC_NOT_ACCEPTABLE, "Cannot negotiate appropriate response format for Accept: " + accept); format = desc.getDefaultFormat();
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()); if (!(WebScriptRequestImpl.MULTIPART_FORM_DATA.equals(contentType) && getDescription().getMultipartProcessing() == false))
throw new WebScriptException("WebScript " + description.getId() + " already associated with the '" + this.container.getName() + "' container"); this.basePath = description.getId();
String scriptId = getDescription().getId(); StatusTemplate template = getStatusTemplate(scriptId, statusCode, statusFormat); String mimetype = container.getFormatRegistry().getMimeType(req.getAgent(), template.getFormat()); if (mimetype == null) throw new WebScriptException("Web Script format '" + template.getFormat() + "' is not registered"); logger.debug("Force success status header in response: " + req.forceSuccessStatus()); logger.debug("Sending status " + statusCode + " (Template: " + template.getPath() + ")"); logger.debug("Rendering response: content type=" + mimetype); res.setStatus(req.forceSuccessStatus() ? HttpServletResponse.SC_OK : statusCode); String location = status.getLocation(); if (location != null && location.length() > 0)
if (scWebscript != null) String storePath = scWebscript.getDescription().getStorePath(); String descPath = scWebscript.getDescription().getDescPath(); model.put("subComponent_resolvedWSStorePath", storePath); model.put("subComponent_resolvedWSDescPath", descPath); if (webscript != null) String storePath = webscript.getDescription().getStorePath(); String descPath = webscript.getDescription().getDescPath(); model.put("resolvedWSStorePath", storePath); model.put("resolvedWSDescPath", descPath);
if (script.getDescription().getPackage() == null || !script.getDescription().getPackage().toString().startsWith(packageFilter)) Set<String> familys = script.getDescription().getFamilys(); String[] uris = script.getDescription().getURIs(); for (String uri : uris)
String scriptId = req.getExtensionPath(); if (scriptId == null || scriptId.length() == 0) throw new WebScriptException("Web Script Id not provided"); if (script == null) throw new WebScriptException("Web Script Id '" + scriptId + "' not found"); Map<String, String> implPaths = new HashMap<String, String>(); List<ScriptStore> modelStores = new ArrayList<ScriptStore>(); model.put("script", script.getDescription()); model.put("script_class", script.getClass().toString()); model.put("stores", modelStores); throw new WebScriptException("Failed to search for documents for script " + script.getDescription().getId() + " in store " + store, e);
Set<String> familys = webscript.getDescription().getFamilys(); if (familys != null && familys.contains(family)) values.add(new ScriptWebScript(webscript.getDescription())); values.add(new ScriptWebScript(webscript.getDescription()));
/** * Register a Web Script URI * * @param script WebScript */ private void registerURIs(WebScript script) { Description desc = script.getDescription(); for (String uri : desc.getURIs()) { PathImpl path = uriByPath.get("/"); String[] parts = uri.split("/"); for (String part : parts) { if (part.indexOf("?") != -1) { part = part.substring(0, part.indexOf("?")); } PathImpl subpath = uriByPath.get(PathImpl.concatPath(path.getPath(), part)); if (subpath == null) { subpath = path.createChildPath(part); uriByPath.put(subpath.getPath(), subpath); } path = subpath; } path.addScript(script); } }
public String getId() { return description.getId(); }
/** * Register a lifecycle * * @param script WebScript */ private void registerLifecycle(WebScript script) { Description desc = script.getDescription(); Lifecycle lifecycle = desc.getLifecycle(); PathImpl path = lifecycleByPath.get("/"); PathImpl subpath = lifecycleByPath.get(PathImpl.concatPath(path.getPath(), lifecycle.toString())); if (subpath == null) { subpath = path.createChildPath(lifecycle.toString()); lifecycleByPath.put(subpath.getPath(), subpath); } subpath.addScript(script); }
public FormatStyle getFormatStyle() { Match match = getServiceMatch(); if (match == null) { return FormatStyle.any; } FormatStyle style = match.getWebScript().getDescription().getFormatStyle(); if (style != FormatStyle.any) { return style; } else { String argFormat = getParameter(ARG_FORMAT); if (argFormat != null && argFormat.length() > 0) { return FormatStyle.argument; } else { return FormatStyle.extension; } } }