org.restlet.data.Request.getEntityAsForm()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中org.restlet.data.Request.getEntityAsForm方法的一些代码示例,展示了Request.getEntityAsForm的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getEntityAsForm方法的具体详情如下:
包路径:org.restlet.data.Request
类名称:Request
方法名:getEntityAsForm

Request.getEntityAsForm介绍

暂无

代码示例

代码示例来源:origin: internetarchive/heritrix3

@Override
public void acceptRepresentation(Representation entity) throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  chosenEngine = form.getFirstValue("engine");
  String script = form.getFirstValue("script");
  if(StringUtils.isBlank(script)) {
    script="";
  }
  ScriptEngine eng = MANAGER.getEngineByName(chosenEngine);
  
  scriptingConsole.bind("scriptResource",  this);
  scriptingConsole.execute(eng, script);
  scriptingConsole.unbind("scriptResource");
  
  //TODO: log script, results somewhere; job log INFO? 
  
  getResponse().setEntity(represent());
}

代码示例来源:origin: internetarchive/heritrix3

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);
}

代码示例来源:origin: internetarchive/heritrix3

throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  String newContents = form.getFirstValue("contents");
  EditRepresentation er;

代码示例来源:origin: internetarchive/heritrix3

form = getRequest().getEntityAsForm();
String copyTo = form.getFirstValue("copyTo");
if (copyTo != null) {

代码示例来源:origin: internetarchive/heritrix3

@Override
public void acceptRepresentation(Representation entity) throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  String action = form.getFirstValue("action");
  if("rescan".equals(action)) {

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns the entity as a DOM representation.<br>
 * Note that this triggers the parsing of the entity into a reusable DOM
 * document stored in memory.<br>
 * This method and the related getEntity*() methods can only be invoked
 * once.
 * 
 * @return The entity as a DOM representation.
 */
@Override
public Form getEntityAsForm() {
  return getWrappedRequest().getEntityAsForm();
}

代码示例来源:origin: org.geowebcache/gwc-rest

public void doPost(Request req, Response resp) throws RestletException {
  Form form = req.getEntityAsForm();

代码示例来源:origin: org.archive.heritrix/heritrix-engine

@Override
public void acceptRepresentation(Representation entity) throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  chosenEngine = form.getFirstValue("engine");
  String script = form.getFirstValue("script");
  if(StringUtils.isBlank(script)) {
    script="";
  }
  ScriptEngine eng = MANAGER.getEngineByName(chosenEngine);
  
  scriptingConsole.bind("scriptResource",  this);
  scriptingConsole.execute(eng, script);
  scriptingConsole.unbind("scriptResource");
  
  //TODO: log script, results somewhere; job log INFO? 
  
  getResponse().setEntity(represent());
}

代码示例来源:origin: org.archive.heritrix/heritrix-engine

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);
}

代码示例来源:origin: org.restlet/org.restlet

final Form form = request.getEntityAsForm();

代码示例来源:origin: org.archive.heritrix/heritrix-engine

throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  String newContents = form.getFirstValue("contents");
  EditRepresentation er;

代码示例来源:origin: org.archive.heritrix/heritrix-engine

form = getRequest().getEntityAsForm();
String copyTo = form.getFirstValue("copyTo");
if (copyTo != null) {

代码示例来源:origin: org.archive.heritrix/heritrix-engine

@Override
public void acceptRepresentation(Representation entity) throws ResourceException {
  Form form = getRequest().getEntityAsForm();
  String action = form.getFirstValue("action");
  if("rescan".equals(action)) {

代码示例来源:origin: org.geowebcache/gwc-rest

Form form = req.getEntityAsForm();

相关文章