示例#1
0
 private void view(
     HttpServletRequest request,
     HttpServletResponse response,
     ModelAndView next,
     WikiPageInfo pageInfo)
     throws Exception {
   String topicName = WikiUtil.getTopicFromURI(request);
   if (StringUtils.isBlank(topicName)) {
     String virtualWikiName = pageInfo.getVirtualWikiName();
     VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
     topicName = virtualWiki.getRootTopicName();
   }
   String virtualWiki = pageInfo.getVirtualWikiName();
   if (StringUtils.isBlank(virtualWiki)) {
     virtualWiki = VirtualWiki.defaultVirtualWiki().getName();
   }
   Topic topic = ServletUtil.initializeTopic(virtualWiki, topicName);
   if (topic.getTopicId() <= 0) {
     // topic does not exist, return 404 and display empty page
     response.setStatus(HttpServletResponse.SC_NOT_FOUND);
     WikiMessage wikiMessage = new WikiMessage("topic.notcreated");
     // topic name is escaped from WikiUtil.getTopicFromURI, so do not double-escape
     wikiMessage.setParamsWithoutEscaping(new String[] {topicName});
     next.addObject("notopic", wikiMessage);
   }
   WikiMessage pageTitle = new WikiMessage("topic.title", topicName);
   ServletUtil.viewTopic(request, next, pageInfo, pageTitle, topic, true, true);
 }
示例#2
0
 private String processLegacyLogin(HttpServletRequest request) throws JspException {
   WikiMessage messageObject = (WikiMessage) request.getAttribute("messageObject");
   if (messageObject == null) {
     return null;
   }
   String message =
       Utilities.formatMessage(
           messageObject.getKey(),
           ServletUtil.retrieveUserLocale(request),
           messageObject.getParams());
   return formatMessage(message);
 }