Package org.jamwiki

Examples of org.jamwiki.WikiException


    WikiPageInfo pageInfo = new WikiPageInfo(request);
    pageInfo.setPageTitle(new WikiMessage("error.title"));
    pageInfo.setContentJsp(JSP_ERROR);
    pageInfo.setSpecial(true);
    if (t instanceof WikiException) {
      WikiException we = (WikiException) t;
      next.addObject("messageObject", we.getWikiMessage());
    } else {
      next.addObject("messageObject", new WikiMessage("error.unknown", t
          .toString()));
    }
    try {
View Full Code Here


  private void linksTo(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (StringUtils.isBlank(topicName)) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    WikiMessage pageTitle = new WikiMessage("linkto.title", topicName);
    pageInfo.setPageTitle(pageTitle);
    // grab search engine instance and find
    // List<SearchResultEntry> results =
View Full Code Here

   *
   */
  private void delete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    deletePage(request, next, pageInfo, topicName);
    String manageCommentsPage = WikiUtil.getParameterFromRequest(request, "manageCommentsPage", true);
    if (!StringUtils.isBlank(manageCommentsPage)) {
      if (WikiUtil.isCommentsPage(manageCommentsPage) && !manageCommentsPage.equals(topicName)) {
View Full Code Here

   */
  private void permissions(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null);
    if (topic == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    topic.setReadOnly(request.getParameter("readOnly") != null);
    topic.setAdminOnly(request.getParameter("adminOnly") != null);
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), null, topic.getTopicContent(), 0);
View Full Code Here

   *
   */
  private void undelete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    undeletePage(request, next, pageInfo, topicName);
    String manageCommentsPage = WikiUtil.getParameterFromRequest(request, "manageCommentsPage", true);
    if (!StringUtils.isBlank(manageCommentsPage)) {
      if (WikiUtil.isCommentsPage(manageCommentsPage) && !manageCommentsPage.equals(topicName)) {
View Full Code Here

  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, true, null);
    if (topic == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    String commentsPage = WikiUtil.extractCommentsLink(topicName);
    if (!topicName.equals(commentsPage)) {
      Topic commentsTopic = WikiBase.getDataHandler().lookupTopic(virtualWiki, commentsPage, true, null);
      if (commentsTopic != null && commentsTopic.getDeleted() == topic.getDeleted()) {
View Full Code Here

    // }
    // if (topic.getReadOnly()) {
    // throw new WikiException(new WikiMessage("error.readonly"));
    // }
    // it should be impossible to get here...
    throw new WikiException(new WikiMessage("error.unknown",
        "Unable to determine topic editing permissions"));
  }
View Full Code Here

      contents = spliceResult[1];
      sectionName = parserOutput.getSectionName();
    }
    if (contents == null) {
      logger.warning("The topic " + topicName + " has no content");
      throw new WikiException(new WikiMessage("edit.exception.nocontent",
          topicName));
    }
    // strip line feeds
    contents = StringUtils.remove(contents, '\r');
    String lastTopicContent = (lastTopic != null) ? StringUtils.remove(
View Full Code Here

   */
  protected ModelAndView handleJAMWikiRequest(HttpServletRequest request,
      HttpServletResponse response, ModelAndView next, WikiPageInfo pageInfo)
      throws Exception {
    if (!WikiUtil.isFirstUse()) {
      throw new WikiException(new WikiMessage("setup.error.notrequired"));
    }
    String function = (request.getParameter("function") == null) ? request
        .getParameter("override") : request.getParameter("function");
    if (function == null) {
      function = "";
    }
    try {
      if (!SystemUtils.isJavaVersionAtLeast(MINIMUM_JDK_VERSION)) {
        throw new WikiException(new WikiMessage("setup.error.jdk", Integer
            .valueOf(MINIMUM_JDK_VERSION).toString(), System
            .getProperty("java.version")));
      }
      if (!StringUtils.isBlank(function) && initialize(request, next, pageInfo)) {
        ServletUtil.redirect(next, WikiBase.DEFAULT_VWIKI, Environment
View Full Code Here

      this.view(request, next, pageInfo);
    } catch (Exception ex) {
      logger.severe("Unable to set up page view object for setup.jsp", ex);
    }
    if (e instanceof WikiException) {
      WikiException we = (WikiException) e;
      next.addObject("messageObject", we.getWikiMessage());
    } else {
      next.addObject("messageObject", new WikiMessage("error.unknown", e
          .getMessage()));
    }
  }
View Full Code Here

TOP

Related Classes of org.jamwiki.WikiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.