org.apache.wicket.Request.getRelativePathPrefixToContextRoot()方法的使用及代码示例

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

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

Request.getRelativePathPrefixToContextRoot介绍

[英]Gets a prefix to make this relative to the context root.

For example, if your context root is http://server.com/myApp/ and the request is for /myApp/mountedPage/, then the prefix returned might be "../../".

For a particular technology, this might return either an absolute prefix or a relative one.
[中]获取一个前缀,使其相对于上下文根。
例如,如果您的上下文根是http://server.com/myApp/请求是/myApp/mountedPage/,那么返回的前缀可能是“../../”。
对于特定技术,这可能返回绝对前缀或相对前缀。

代码示例

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * @see org.apache.wicket.Request#getRelativePathPrefixToContextRoot()
 */
@Override
public String getRelativePathPrefixToContextRoot()
{
  return request.getRelativePathPrefixToContextRoot();
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

public String getRelativePathPrefixToContextRoot()
{
  return realRequest.getRelativePathPrefixToContextRoot();
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

public String getRelativePathPrefixToContextRoot()
{
  return request.getRelativePathPrefixToContextRoot();
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

private static final String returnRelativePath(String location)
{
  // WICKET-59 allow external URLs, WICKET-612 allow absolute URLs.
  if (location.startsWith("http://") || location.startsWith("https://") ||
    location.startsWith("/"))
  {
    return location;
  }
  else
  {
    return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + location;
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
   * Rewrites a relative url to be context relative, leaves absolute urls same.
   * 
   * @param url
   * @param request
   * @return rewritten url
   */
  public static String rewriteToContextRelative(String url, Request request)
  {
    if (isRelative(url))
    {
      final String prefix = request.getRelativePathPrefixToContextRoot();
      return prefix + url;
    }
    else
    {
      return url;
    }
  }
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

public void onComponentTag(Component component, ComponentTag tag)
  {
    String prefix = null;
    // Modify all relevant attributes
    for (int i = 0; i < attributeNames.length; i++)
    {
      String attrName = attributeNames[i];
      String attrValue = tag.getAttributes().getString(attrName);
      if ((attrValue != null) && (attrValue.startsWith("/") == false) &&
          (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#")))
      {
        if (prefix == null)
        {
          prefix = RequestCycle.get().getRequest()
              .getRelativePathPrefixToContextRoot();
        }
        attrValue = prefix + attrValue;
        tag.getAttributes().put(attrName, attrValue);
      }
    }
  }
};

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
   * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
   */
  protected void onComponentTag(final ComponentTag tag)
  {
    checkComponentTag(tag, "img");
    super.onComponentTag(tag);
    tag
        .put("src", getRequest().getRelativePathPrefixToContextRoot() +
            getModelObjectAsString());
  }
}

代码示例来源:origin: ontopia/ontopia

@Override
 public String getObject() {
  return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + "doc/" +
   Application.get().getResourceSettings().getLocalizer().getString(resourceKey, (Component)null, (String)null);
 }
}

代码示例来源:origin: net.ontopia/ontopoly-editor

@Override
 public String getObject() {
  return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + "doc/" +
   Application.get().getResourceSettings().getLocalizer().getString(resourceKey, (Component)null, (String)null);
 }
}

代码示例来源:origin: org.wicketstuff/yui

/**
   * 
   */
   protected void onComponentTag(final ComponentTag tag) 
   {
     checkComponentTag(tag, "img");
     super.onComponentTag(tag);
     String url = getDefaultModelObjectAsString();
     if (url.startsWith("http")) 
     {
       tag.put("src", url);
     } 
     else 
     {
       tag.put("src", getRequest().getRelativePathPrefixToContextRoot() + getDefaultModelObjectAsString());
     }
   }
}

代码示例来源:origin: net.ontopia/ontopoly-editor

@Override
 public final String getObject() {
  TopicMap topicMap = fieldValueModel.getFieldInstanceModel().getFieldInstance().getInstance().getTopicMap();        
  Object o = fieldValueModel.getFieldValue();
  return getRequest().getRelativePathPrefixToContextRoot() + "occurrenceImages?topicMapId=" + topicMap.getId() + 
  "&occurrenceId=" + ((o instanceof OccurrenceIF ? ((OccurrenceIF)o).getObjectId(): "unknown"));
 }
}));

代码示例来源:origin: ontopia/ontopia

@Override
 public final String getObject() {
  TopicMap topicMap = fieldValueModel.getFieldInstanceModel().getFieldInstance().getInstance().getTopicMap();        
  Object o = fieldValueModel.getFieldValue();
  return getRequest().getRelativePathPrefixToContextRoot() + "occurrenceImages?topicMapId=" + topicMap.getId() + 
  "&occurrenceId=" + ((o instanceof OccurrenceIF ? ((OccurrenceIF)o).getObjectId(): "unknown"));
 }
}));

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

.getRelativePathPrefixToContextRoot() +
redirectUrl.substring(1));

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

url = RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() +
    url;

代码示例来源:origin: org.geoserver.web/web-wms

styleContainer.add(defStyleImg);
String wmsURL = getRequest().getRelativePathPrefixToContextRoot();

相关文章