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

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

本文整理了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

  1. /**
  2. * @see org.apache.wicket.Request#getRelativePathPrefixToContextRoot()
  3. */
  4. @Override
  5. public String getRelativePathPrefixToContextRoot()
  6. {
  7. return request.getRelativePathPrefixToContextRoot();
  8. }

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

  1. public String getRelativePathPrefixToContextRoot()
  2. {
  3. return realRequest.getRelativePathPrefixToContextRoot();
  4. }

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

  1. public String getRelativePathPrefixToContextRoot()
  2. {
  3. return request.getRelativePathPrefixToContextRoot();
  4. }

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

  1. private static final String returnRelativePath(String location)
  2. {
  3. // WICKET-59 allow external URLs, WICKET-612 allow absolute URLs.
  4. if (location.startsWith("http://") || location.startsWith("https://") ||
  5. location.startsWith("/"))
  6. {
  7. return location;
  8. }
  9. else
  10. {
  11. return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + location;
  12. }
  13. }

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

  1. /**
  2. * Rewrites a relative url to be context relative, leaves absolute urls same.
  3. *
  4. * @param url
  5. * @param request
  6. * @return rewritten url
  7. */
  8. public static String rewriteToContextRelative(String url, Request request)
  9. {
  10. if (isRelative(url))
  11. {
  12. final String prefix = request.getRelativePathPrefixToContextRoot();
  13. return prefix + url;
  14. }
  15. else
  16. {
  17. return url;
  18. }
  19. }
  20. }

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

  1. public void onComponentTag(Component component, ComponentTag tag)
  2. {
  3. String prefix = null;
  4. // Modify all relevant attributes
  5. for (int i = 0; i < attributeNames.length; i++)
  6. {
  7. String attrName = attributeNames[i];
  8. String attrValue = tag.getAttributes().getString(attrName);
  9. if ((attrValue != null) && (attrValue.startsWith("/") == false) &&
  10. (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#")))
  11. {
  12. if (prefix == null)
  13. {
  14. prefix = RequestCycle.get().getRequest()
  15. .getRelativePathPrefixToContextRoot();
  16. }
  17. attrValue = prefix + attrValue;
  18. tag.getAttributes().put(attrName, attrValue);
  19. }
  20. }
  21. }
  22. };

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

  1. /**
  2. * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
  3. */
  4. protected void onComponentTag(final ComponentTag tag)
  5. {
  6. checkComponentTag(tag, "img");
  7. super.onComponentTag(tag);
  8. tag
  9. .put("src", getRequest().getRelativePathPrefixToContextRoot() +
  10. getModelObjectAsString());
  11. }
  12. }

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

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

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

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

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

  1. /**
  2. *
  3. */
  4. protected void onComponentTag(final ComponentTag tag)
  5. {
  6. checkComponentTag(tag, "img");
  7. super.onComponentTag(tag);
  8. String url = getDefaultModelObjectAsString();
  9. if (url.startsWith("http"))
  10. {
  11. tag.put("src", url);
  12. }
  13. else
  14. {
  15. tag.put("src", getRequest().getRelativePathPrefixToContextRoot() + getDefaultModelObjectAsString());
  16. }
  17. }
  18. }

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

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

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

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

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

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

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

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

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

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

相关文章