public String getBeansRefPath() { Reference ref = getRequest().getResourceRef(); String path = ref.getPath(); int i = path.indexOf("/beans/"); if(i>0) { return path.substring(0,i+"/beans/".length()); } if(!path.endsWith("/")) { path += "/"; } return path; }
/** * Constructs a nested Map data structure with the information represented * by this Resource. The result is particularly suitable for use with with * {@link XmlMarshaller}. * * @return the nested Map data structure */ protected CrawlJobModel makeDataModel() { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if (!baseRef.endsWith("/")) { baseRef += "/"; } return new CrawlJobModel(cj,baseRef); }
/** * Constructs a nested Map data structure with the information represented * by this Resource. The result is particularly suitable for use with with * {@link XmlMarshaller}. * * @return the nested Map data structure */ protected EngineModel makeDataModel() { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } return new EngineModel(getEngine(), baseRef); }
Reference baseRef = getRequest().getResourceRef().getBaseRef();
Reference baseRef = getRequest().getResourceRef().getBaseRef();
protected void writeHtml(Writer writer) { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } Configuration tmpltCfg = getTemplateConfiguration(); ViewModel viewModel = new ViewModel(); viewModel.setFlashes(Flash.getFlashes(getRequest())); viewModel.put("baseRef",baseRef); viewModel.put("model",makeDataModel()); try { Template template = tmpltCfg.getTemplate("Beans.ftl"); template.process(viewModel, writer); writer.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } } }
protected void writeHtml(Writer writer) { EngineModel model = makeDataModel(); String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } Configuration tmpltCfg = getTemplateConfiguration(); ViewModel viewModel = new ViewModel(); viewModel.setFlashes(Flash.getFlashes(getRequest())); viewModel.put("baseRef",baseRef); viewModel.put("fileSeparator", File.separator); viewModel.put("engine", model); try { Template template = tmpltCfg.getTemplate("Engine.ftl"); template.process(viewModel, writer); writer.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } }
public List<Variant> getVariants() { List<Variant> variants = super.getVariants(); Form f = getRequest().getResourceRef().getQueryAsForm(); String format = f.getFirstValue("format"); if("textedit".equals(format)) {
protected void writeHtml(Writer writer) { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } Configuration tmpltCfg = getTemplateConfiguration(); ViewModel viewModel = new ViewModel(); viewModel.setFlashes(Flash.getFlashes(getRequest())); viewModel.put("baseRef",baseRef); viewModel.put("job", makeDataModel()); viewModel.put("heapReport", getEngine().heapReportData()); try { Template template = tmpltCfg.getTemplate("Job.ftl"); template.process(viewModel, writer); writer.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } }
public void acceptRepresentation(Representation entity) throws ResourceException { if (appCtx == null) { throw new ResourceException(404); } // copy op? Form form = getRequest().getEntityAsForm(); beanPath = form.getFirstValue("beanPath"); String newVal = form.getFirstValue("newVal"); if(newVal!=null) { int i = beanPath.indexOf("."); String beanName = i<0?beanPath:beanPath.substring(0,i); Object namedBean = appCtx.getBean(beanName); BeanWrapperImpl bwrap = new BeanWrapperImpl(namedBean); String propPath = beanPath.substring(i+1); Object coercedVal = bwrap.convertIfNecessary(newVal, bwrap.getPropertyValue(propPath).getClass()); bwrap.setPropertyValue(propPath, coercedVal); } Reference ref = getRequest().getResourceRef(); ref.setPath(getBeansRefPath()); ref.addSegment(beanPath); getResponse().redirectSeeOther(ref); }
protected void writeHtml(Writer writer) { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } Configuration tmpltCfg = getTemplateConfiguration(); ViewModel viewModel = new ViewModel(); viewModel.setFlashes(Flash.getFlashes(getRequest())); viewModel.put("baseRef",baseRef); viewModel.put("staticRef", getStaticRef("")); viewModel.put("baseResourceRef",getRequest().getRootRef().toString()+"/engine/static/"); viewModel.put("model", makeDataModel()); viewModel.put("selectedEngine", chosenEngine); try { Template template = tmpltCfg.getTemplate("Script.ftl"); template.process(viewModel, writer); writer.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } } }
/** * Constructs a nested Map data structure with the information represented * by this Resource. The result is particularly suitable for use with with * {@link XmlMarshaller}. * * @return the nested Map data structure */ protected ScriptModel makeDataModel() { String baseRef = getRequest().getResourceRef().getBaseRef().toString(); if(!baseRef.endsWith("/")) { baseRef += "/"; } Reference baseRefRef = new Reference(baseRef); ScriptModel model = new ScriptModel(scriptingConsole, new Reference(baseRefRef, "..").getTargetRef().toString(), getAvailableScriptEngines()); return model; }
new Reference(getRequest().getResourceRef().getBaseRef(), "..").getTargetRef().toString(), beanPath, bean,
/** * Returns the reference of the target resource. * * @return The reference of the target resource. */ @Override public Reference getResourceRef() { return getWrappedRequest().getResourceRef(); }
/** * Returns the parsed query of the request's target resource reference as a * form (series of parameters). * * @return The parsed query. * @see Reference#getQueryAsForm() */ public Form getQuery() { return getRequest().getResourceRef().getQueryAsForm(); }
protected boolean isDescribe( Request request ) { // check do we need describe return request.getResourceRef().getQueryAsForm().getFirst( IS_DESCRIBE_PARAMETER ) != null; }
/** * Returns the optional matrix of the request's target resource reference as * a form (series of parameters). * * @return The parsed query. * @see Reference#getMatrixAsForm() */ public Form getMatrix() { return getRequest().getResourceRef().getMatrixAsForm(); }
@Override public void handle(Request request, Response response) { final String scheme = request.getResourceRef().getScheme(); if (Protocol.WAR.getSchemeName().equalsIgnoreCase(scheme)) { super.handle(request, response); } else { throw new IllegalArgumentException( "Protocol \"" + scheme + "\" not supported by the connector. Only WAR is supported."); } }
@Override protected int beforeHandle(Request request, Response response) { final int result = super.beforeHandle(request, response); // Set the request's root reference request.setRootRef(request.getResourceRef().getBaseRef()); // Save the hash code of the current host setCurrent(VirtualHost.this.hashCode()); return result; } };
protected RepositoryTargetResource getNexusToRestResource(Target target, Request request) { RepositoryTargetResource resource = new RepositoryTargetResource(); resource.setId(target.getId()); resource.setName(target.getName()); resource.setResourceURI(request.getResourceRef().getPath()); resource.setContentClass(target.getContentClass().getId()); List<String> patterns = new ArrayList<String>(target.getPatternTexts()); for (String pattern : patterns) { resource.addPattern(pattern); } return resource; }