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

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

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

Response.redirectSeeOther介绍

[英]Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource.

If you pass a relative target URI, it will be resolved with the current base reference of the request's resource reference (see Request#getResourceRef() and Reference#getBaseRef().
[中]将客户端重定向到另一个URI,应该使用该资源上的GET方法检索该URI。此方法主要用于允许后激活脚本的输出将用户代理重定向到选定的资源。新URI不是最初请求的资源的替代引用。
如果传递相对目标URI,它将使用请求的资源引用的当前基引用进行解析(请参见请求#getResourceRef()和引用#getBaseRef()。

代码示例

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

protected void copyJob(String copyTo, boolean asProfile)
    throws ResourceException {
  try {
    getEngine().copy(cj, copyTo, asProfile);
  } catch (IOException e) {
    Flash.addFlash(getResponse(), "Job not copied: " + e.getMessage(),
        Flash.Kind.NACK);
    getResponse().redirectSeeOther(getRequest().getOriginalRef());
    return;
  }
  // redirect to destination job page
  getResponse().redirectSeeOther(copyTo);
}

代码示例来源: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

public Representation represent(Variant variant) throws ResourceException {
    // generate report
    if (cj == null || cj.getCrawlController() == null) {
      throw new ResourceException(500);
    }
    File f = cj.getCrawlController().getStatisticsTracker().writeReportFile(reportClass); 
    if (f==null) {
      throw new ResourceException(500);
    }
    // redirect
    String relative = JobResource.getHrefPath(f,cj);
    if(relative!=null) {
      getResponse().redirectSeeOther("../"+relative+"?m="+f.lastModified());
      return new StringRepresentation("");
    } else {
      return new StringRepresentation(
          "Report dumped to "+f.getAbsolutePath()
          +" (outside job directory)");
    }
  }
}

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

getResponse().redirectSeeOther(ref);

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

getResponse().redirectSeeOther(getRequest().getOriginalRef());

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

getResponse().redirectSeeOther(getRequest().getOriginalRef());

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

/**
 * Redirects the client to a different URI that SHOULD be retrieved using a
 * GET method on that resource. This method exists primarily to allow the
 * output of a POST-activated script to redirect the user agent to a
 * selected resource. The new URI is not a substitute reference for the
 * originally requested resource.
 * 
 * @param targetRef
 *            The target reference.
 */
@Override
public void redirectSeeOther(Reference targetRef) {
  getWrappedResponse().redirectSeeOther(targetRef);
}

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

/**
 * Redirects the client to a different URI that SHOULD be retrieved using a
 * GET method on that resource. This method exists primarily to allow the
 * output of a POST-activated script to redirect the user agent to a
 * selected resource. The new URI is not a substitute reference for the
 * originally requested resource.
 * 
 * @param targetUri
 *            The target URI.
 */
@Override
public void redirectSeeOther(String targetUri) {
  getWrappedResponse().redirectSeeOther(targetUri);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@Override
public void handleGet()
{
  getResponse().redirectSeeOther(String.format("%s/", getRequest().getRootRef()));
}

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

protected void copyJob(String copyTo, boolean asProfile)
    throws ResourceException {
  try {
    getEngine().copy(cj, copyTo, asProfile);
  } catch (IOException e) {
    Flash.addFlash(getResponse(), "Job not copied: " + e.getMessage(),
        Flash.Kind.NACK);
    getResponse().redirectSeeOther(getRequest().getOriginalRef());
    return;
  }
  // redirect to destination job page
  getResponse().redirectSeeOther(copyTo);
}

代码示例来源: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.archive.heritrix/heritrix-engine

public Representation represent(Variant variant) throws ResourceException {
    // generate report
    if (cj == null || cj.getCrawlController() == null) {
      throw new ResourceException(500);
    }
    File f = cj.getCrawlController().getStatisticsTracker().writeReportFile(reportClass); 
    if (f==null) {
      throw new ResourceException(500);
    }
    // redirect
    String relative = JobResource.getHrefPath(f,cj);
    if(relative!=null) {
      getResponse().redirectSeeOther("../"+relative+"?m="+f.lastModified());
      return new StringRepresentation("");
    } else {
      return new StringRepresentation(
          "Report dumped to "+f.getAbsolutePath()
          +" (outside job directory)");
    }
  }
}

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

getResponse().redirectSeeOther(ref);

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

getResponse().redirectSeeOther(getRequest().getOriginalRef());

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

getResponse().redirectSeeOther(getRequest().getOriginalRef());

代码示例来源:origin: org.geoserver/rest

getResponse().redirectSeeOther(uri);

相关文章