org.apache.wicket.markup.html.WebPage类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(109)

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

WebPage介绍

[英]Base class for HTML pages. This subclass of Page simply returns HTML when asked for its markup type. It also has a method which subclasses can use to retrieve a bookmarkable link to the application's home page.

WebPages can be constructed with any constructor when they are being used in a Wicket session, but if you wish to link to a Page using a URL that is "bookmarkable" (which implies that the URL will not have any session information encoded in it, and that you can call this page directly without having a session first directly from your browser), you need to implement your Page with a no-arg constructor or with a constructor that accepts a PageParameters argument (which wraps any query string parameters for a request). In case the page has both constructors, the constructor with PageParameters will be used.
[中]HTML页面的基类。当请求页面的标记类型时,页面的这个子类只返回HTML。它还有一个方法,子类可以使用该方法检索指向应用程序主页的可书签链接。
在Wicket会话中使用网页时,可以使用任何构造函数构建网页,但如果您希望使用“可书签”的URL链接到网页(这意味着URL中不会编码任何会话信息,并且您可以直接调用此网页,而无需先从浏览器直接进行会话),您需要使用无参数构造函数或接受PageParameters参数(包装请求的任何查询字符串参数)的构造函数来实现页面。如果页面同时具有两个构造函数,则将使用带有PageParameters的构造函数。

代码示例

代码示例来源:origin: org.apache.wicket/wicket-examples-jar

@Override
  public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
//        Bootstrap.renderHead(response);
//        response.render(CssHeaderItem.forCSS(
//                "body { padding-top: 60px; padding-bottom: 40px; }",
//                "custom-wicket-examples"));
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

@Override
protected void onInitialize()
{
  super.onInitialize();
  add(getTestPanel(TEST_PANEL_ID));
}

代码示例来源:origin: brix-cms/brix-cms

@Override
  protected void configureResponse(WebResponse response) {
    super.configureResponse(response);
    response.setStatus(HttpServletResponse.SC_FORBIDDEN);
  }
}

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

/**
 * @see org.apache.wicket.Page#configureResponse()
 */
protected void configureResponse()
{
  super.configureResponse();
  if (getWebRequestCycle().getResponse() instanceof WebResponse)
  {
    final WebResponse response = getWebRequestCycle().getWebResponse();
    setHeaders(response);
  }
}

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

/**
 * @see org.apache.wicket.markup.html.INewBrowserWindowListener#onNewBrowserWindow()
 */
public void onNewBrowserWindow()
{
  // if the browser reports a history of 0 then make a new webpage
  WebPage clonedPage = this;
  try
  {
    clonedPage = (WebPage)Objects.cloneObject(this);
  }
  catch (Exception e)
  {
    log.error("Page " + clonedPage + " couldn't be cloned to move to another pagemap", e);
  }
  final IPageMap map = getSession().createAutoPageMap();
  clonedPage.moveToPageMap(map);
  setResponsePage(clonedPage);
}

代码示例来源:origin: apache/wicket

@Override
protected void onRender()
{
  // Configure the response such as headers etc.
  configureResponse((WebResponse)RequestCycle.get().getResponse());
  // The rules if and when to insert an xml decl in the response are a bit tricky. Allow the
  // user to replace the default per page and per application.
  renderXmlDecl();
  super.onRender();
}

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

HtmlHeaderContainer header = (HtmlHeaderContainer)visitChildren(new IVisitor<Component>()
  add(header);
  Response orgResponse = getRequestCycle().getResponse();
  try
    getRequestCycle().setResponse(response);
    renderHead(header);
    visitChildren(new IVisitor<Component>()
    this.remove(header);
    getRequestCycle().setResponse(orgResponse);

代码示例来源:origin: org.apache.wicket/wicket-core

HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
  add(header);
  RequestCycle requestCycle = getRequestCycle();
  Response orgResponse = requestCycle.getResponse();
  try
    AbstractHeaderRenderStrategy.get().renderHeader(header, null, getPage());
    if (collectedHeaderOutput.length() > 0)
      reportMissingHead(collectedHeaderOutput);
    this.remove(header);
    requestCycle.setResponse(orgResponse);

代码示例来源:origin: micromata/projectforge

@Override
protected void onBeforeRender()
{
 super.onBeforeRender();
 alreadySubmitted = false;
}

代码示例来源:origin: org.opensingular/singular-requirement-commons

@Override
  protected void onConfigure() {
    super.onConfigure();
    WebMarkupContainer container = new WebMarkupContainer("output") {
      @Override
      public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
        try {
          CharArrayWriter baos = new CharArrayWriter(0);
          DocumentationDefinitionResolver.get().renderDocumentationHTML(typeLoader.loadTypeOrException(stypeClass), baos);
          replaceComponentTagBody(markupStream, openTag, baos.toString());
        } catch (Exception e) {
          throw SingularException.rethrow(e.getMessage(), e);
        }
      }
    };
    queue(container);
  }
}

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

/**
 * Common code executed by constructors.
 */
private void commonInit()
{
  // if automatic multi window support is on, add a page checker instance
  if (getApplication().getPageSettings().getAutomaticMultiWindowSupport())
  {
    add(new PageMapChecker(this));
  }
}

代码示例来源:origin: apache/wicket

/**
 * Set-up response with appropriate content type, locale and encoding. The locale is set equal
 * to the session's locale. The content type header contains information about the markup type
 * (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined
 * by an application setting (@see ApplicationSettings#getResponseRequestEncoding()). If null,
 * no xml decl will be written.
 * 
 * @param response
 *            The WebResponse object
 */
protected void configureResponse(final WebResponse response)
{
  // Users may subclass setHeader() to set there own headers
  setHeaders(response);
  // The response encoding is an application setting
  final String encoding = getApplication().getRequestCycleSettings()
    .getResponseRequestEncoding();
  final boolean validEncoding = (Strings.isEmpty(encoding) == false);
  final String contentType;
  if (validEncoding)
  {
    contentType = getMarkupType().getMimeType() + "; charset=" + encoding;
  }
  else
  {
    contentType = getMarkupType().getMimeType();
  }
  response.setContentType(contentType);
}

代码示例来源:origin: org.opensingular/singular-server-module

private void configureReload(WebPage destination) {
  destination.add(new Behavior() {
    @Override
    public void renderHead(Component component, IHeaderResponse response) {
      response.render(JavaScriptReferenceHeaderItem.forReference(new PackageResourceReference(ServerTemplate.class, "singular.js")));
    }
  });
  destination.add($b.onReadyScript(() -> " Singular.atualizarContentWorklist(); "));
}

代码示例来源:origin: micromata/projectforge

private void internalLogin(final WebPage page, final PFUserDO user)
{
 final UserContext userContext = new UserContext(PFUserDO.createCopyWithoutSecretFields(user),
   getUserGroupCache());
 ((MySession) page.getSession()).login(userContext, page.getRequest());
 UserFilter.login(WicketUtils.getHttpServletRequest(page.getRequest()), userContext);
}

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

@Override
public GeoServerSession getSession() {
  return (GeoServerSession) super.getSession();
}

代码示例来源:origin: org.wamblee/wamblee-wicket-components

@Override
protected void setHeaders(WebResponse aResponse) {
  super.setHeaders(aResponse);
  behaviors.setHeaders(this, aResponse);
}

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

protected void onAfterRender()
  if (getApplication().getConfigurationType() == Application.DEVELOPMENT)
    HtmlHeaderContainer header = (HtmlHeaderContainer)visitChildren(new IVisitor()
      add(header);
      Response orgResponse = getRequestCycle().getResponse();
      try
        getRequestCycle().setResponse(response);
        renderHead(header);
        visitChildren(new IVisitor()
        this.remove(header);
        getRequestCycle().setResponse(orgResponse);

代码示例来源:origin: apache/wicket

HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
  add(header);
  RequestCycle requestCycle = getRequestCycle();
  Response orgResponse = requestCycle.getResponse();
  try
    AbstractHeaderRenderStrategy.get().renderHeader(header, null, getPage());
    if (collectedHeaderOutput.length() > 0)
      reportMissingHead(collectedHeaderOutput);
    this.remove(header);
    requestCycle.setResponse(orgResponse);

代码示例来源:origin: apache/wicket

@Override
  protected void onBeforeRender()
  {
    super.onBeforeRender();
    DevelopmentUtilitiesNotEnabledException.check();
  }
}

代码示例来源:origin: org.opensingular/singular-requirement-module

@Override
  protected void onConfigure() {
    super.onConfigure();
    WebMarkupContainer container = new WebMarkupContainer("output") {
      @Override
      public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
        try {
          CharArrayWriter baos = new CharArrayWriter(0);
          DocumentationDefinitionResolver.get().renderDocumentationHTML(typeLoader.loadTypeOrException(stypeClass), baos);
          replaceComponentTagBody(markupStream, openTag, baos.toString());
        } catch (Exception e) {
          throw SingularException.rethrow(e.getMessage(), e);
        }
      }
    };
    queue(container);
  }
}

相关文章