本文整理了Java中org.restlet.data.Request.getRootRef
方法的一些代码示例,展示了Request.getRootRef
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getRootRef
方法的具体详情如下:
包路径:org.restlet.data.Request
类名称:Request
方法名:getRootRef
[英]Returns the application root reference.
[中]返回应用程序根引用。
代码示例来源:origin: internetarchive/heritrix3
protected String getStaticRef(String resource) {
String rootRef = getRequest().getRootRef().toString();
return rootRef + "/engine/static/" + resource;
}
}
代码示例来源:origin: internetarchive/heritrix3
protected String getStaticRef(String resource) {
String rootRef = dirResource.getRequest().getRootRef().toString();
return rootRef + "/engine/static/" + resource;
}
代码示例来源:origin: internetarchive/heritrix3
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);
}
}
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the application root reference.
*
* @return The application root reference.
*/
@Override
public Reference getRootRef() {
return getWrappedRequest().getRootRef();
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
protected String getStaticRef(String resource) {
String rootRef = getRequest().getRootRef().toString();
return rootRef + "/engine/static/" + resource;
}
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
protected String getStaticRef(String resource) {
String rootRef = dirResource.getRequest().getRootRef().toString();
return rootRef + "/engine/static/" + resource;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
/**
* Returns the resource-path for the given request, does not include "service/local" prefix.
* Should never start with "/".
*/
private String getResourcePath(final Request request) {
// do not use getContentRoot() here, we do not want force base-url messing up resource path extraction
String rootUri = request.getRootRef().getTargetRef().toString();
if (!rootUri.endsWith("/")) {
rootUri += "/";
}
String resourceUri = request.getResourceRef().getTargetRef().toString();
String path = resourceUri.substring(rootUri.length());
if (path.startsWith("/")) {
path = path.substring(1, path.length());
}
// in a runtime instance the root-ref will include service/local since restlet is no longer mounted at root
// so this should be stripped off as part of substring above
checkState(!path.startsWith("service/local"));
return path;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
@Override
public void handleGet()
{
getResponse().redirectSeeOther(String.format("%s/", getRequest().getRootRef()));
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
protected Reference createRedirectReference( Request request )
{
String uriPart =
request.getResourceRef().getTargetRef().toString().substring(
request.getRootRef().getTargetRef().toString().length() );
// trim leading slash
if ( uriPart.startsWith( "/" ) )
{
uriPart = uriPart.substring( 1 );
}
Reference result = updateBaseRefPath( new Reference( getContextRoot( request ), uriPart ) ).getTargetRef();
return result;
}
代码示例来源:origin: org.geoserver/rest
String baseURL = request.getRootRef().getParentRef().toString();
String rootPath = request.getRootRef().toString().substring(baseURL.length());
String pagePath = request.getResourceRef().toString().substring(baseURL.length());
String basePath = null;
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
@Override
public Reference getContextRoot( Request request )
{
Reference result = null;
if ( globalRestApiSettings.isEnabled() && globalRestApiSettings.isForceBaseUrl()
&& StringUtils.isNotEmpty( globalRestApiSettings.getBaseUrl() ) )
{
result = new Reference( globalRestApiSettings.getBaseUrl() );
}
else
{
result = request.getRootRef();
}
// fix for when restlet is at webapp root
if ( StringUtils.isEmpty( result.getPath() ) )
{
result.setPath( "/" );
}
return result;
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
templatingContext.put( "nexusRoot", request.getRootRef().toString() );
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
baseURL = Request.getCurrent().getRootRef().getParentRef().getParentRef().toString();
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
@Override
public Reference getContextRoot(Request request) {
Reference result = null;
if (globalRestApiSettings.isEnabled() && globalRestApiSettings.isForceBaseUrl()
&& StringUtils.isNotEmpty(globalRestApiSettings.getBaseUrl())) {
result = new Reference(globalRestApiSettings.getBaseUrl());
}
else {
// TODO: NEXUS-6045 hack, Restlet app root is now "/service/local", so going up 2 levels!
result = request.getRootRef().getParentRef().getParentRef();
}
// fix for when restlet is at webapp root
if (StringUtils.isEmpty(result.getPath())) {
result.setPath("/");
}
return result;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
private String getResourceUri(Request req, ContentListResource resource, StorageItem child) {
// NEXUS-4244: simply force both baseURLs, coming from nexus.xml and extracted from current request
// to end with slash ("/").
Reference root = getContextRoot(req);
if (StringUtils.isBlank(root.getPath()) || !root.getPath().endsWith("/")) {
root.setPath(StringUtils.defaultString(root.getPath(), "") + "/");
}
Reference requestRoot = req.getRootRef().getParentRef().getParentRef();
if (StringUtils.isBlank(requestRoot.getPath()) || !requestRoot.getPath().endsWith("/")) {
requestRoot.setPath(StringUtils.defaultString(requestRoot.getPath(), "") + "/");
}
final Reference ref = req.getResourceRef().getTargetRef();
String uri = ref.toString();
if (ref.getQuery() != null) {
uri = uri.substring(0, uri.length() - ref.getQuery().length() - 1);
}
if (!uri.endsWith("/")) {
uri += "/";
}
uri += child.getName();
if (!resource.isLeaf()) {
uri += "/";
}
if (root == requestRoot || root.equals(requestRoot)) {
return uri;
}
else {
return uri.replace(requestRoot.toString(), root.toString());
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
baseURL = Request.getCurrent().getRootRef().toString();
代码示例来源:origin: org.archive.heritrix/heritrix-engine
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);
}
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
Reference requestRoot = req.getRootRef();
if ( StringUtils.isBlank( requestRoot.getPath() ) || !requestRoot.getPath().endsWith( "/" ) )
代码示例来源:origin: org.restlet/org.restlet
this.request.getRootRef());
} else if (variableName.equals("p")) {
if (this.request.getProtocol() != null) {
内容来源于网络,如有侵权,请联系作者删除!