コード例 #1
0
 int getUsersOS() {
   HttpServletRequest servletRequest = ExecutingHttpRequest.get();
   if (servletRequest == null) {
     servletRequest = ServletActionContext.getRequest();
   }
   return getBrowserOperationSystem(servletRequest);
 }
コード例 #2
0
  /** Get the template to show. */
  protected Template handleRequest(
      javax.servlet.http.HttpServletRequest aRequest,
      javax.servlet.http.HttpServletResponse aResponse,
      Context ctx)
      throws java.lang.Exception {
    // Bind standard WebWork utility into context

    ServletActionContext.setContext(aRequest, aResponse, getServletContext(), null);
    ctx.put(WEBWORK_UTIL, new WebWorkUtil(ctx));

    String servletPath = (String) aRequest.getAttribute("javax.servlet.include.servlet_path");
    if (servletPath == null) servletPath = aRequest.getServletPath();
    return getTemplate(servletPath);
  }
コード例 #3
0
  /**
   * Default method runs when displaying portal pages.
   *
   * @return the view to display
   */
  public String doDefault() {
    // Figure out which Tab (view) to show the user.
    String tab;
    if (StringUtils.isNotBlank(view)) {
      // the user has clicked on a particular tab - we show this one.
      tab = view;

    } else {
      // the user did not click on a particular tab.
      // Find which one they clicked on last.
      tab = getTabFromSession();
    }

    if (contentOnly && !isValid(tab)) {
      ServletActionContext.getResponse().setStatus(401);
      return NONE;
    }

    if (!contentOnly) {
      webResourceManager.requireResource("jira.webresources:managedashboards");
    }

    if (Tab.SEARCH.equalsIgnoreCase(tab)) {
      showSearchTab();
    } else if (Tab.POPULAR.equalsIgnoreCase(tab)) {
      showPopularTab();
    } else if (Tab.MY.equalsIgnoreCase(tab)) {
      // We attempt to show the "My" tab, although if it is empty, we may show another one instead.
      showMyTab();
    } else if (Tab.FAVOURITES.equalsIgnoreCase(tab)) {
      // We attempt to show the "FAVOURITES" tab, although if it is empty, we may show another one
      // instead.
      showFavouritesTab();
    } else {
      if (getLoggedInUser() == null) {
        showPopularTab();
      } else {
        showFavouritesTab();
      }
    }
    // remember the current tab, in case we need to know which one to show next time.
    storeTabInSession(view);

    return contentOnly ? CONTENTONLY : SUCCESS;
  }