[Logo] JForum - Powering Communities
  [Search] 搜尋   [Recent Topics] 最新主題   [Hottest Topics] 熱門主題   [Top Downloads] 熱門下載   [Members] 會員列表   [Groups] 回首頁 
[Moderation Log] 管理日誌   [Register] 會員註冊 /  [Login] 登入 


JForum 2.5.0 released, download it from here.
How to add jforum in sub-directory in webapp  RSS feed
討論區首頁 » User Forum
發表人 內容
Amy


註冊時間: 2018/3/26
文章: 6
離線
I have a maven webapp (say rootApp ) I want to add jforum to rootApp/forum path.

  • I installed jforum initially to set up the database and then copied the files in it to rootApp/forum.

  • I copied content of rootApp/forum/WEB-INF/ to rootApp/WEB-INF/

  • I copied rootApp/forum/templates directory to rootApp/


  • But when I go to rootApp/forum/ it redirects and the forum is executed on rootApp. I want all the URL's to be on rootApp/forum/.... How to achieve this?
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    I haven't tried this, but a few things come to mind:

  • In web.xml, CSRFGuard probably needs to map to /forum/*


  • You need to ensure that there are no *.ftl and *.page URLs elsewhere in the web app


  • There are a few entries in jforum-custom.conf that need to be adapted; at the least forum.link, homepage.link and context.path

  • Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    Amy


    註冊時間: 2018/3/26
    文章: 6
    離線
    I tried all those and a lot more, but couldn't get it through smilie

    I believe the problem is that I copied the templates directory in the root, so I put it back inside src/main/webapp/forum but now it throws an exception saying path "...src/main/webapp/templates" cannot be found.

    How can I update the context path for jforum so that it includes "forum/"?
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    That could be the context.path entry I mentioned in config/jforum-custom.conf. The problem I see is that "context path" has a specific meaning for Java web apps (for the root web app it would be "/" which can't be changed), and I'm not sure that changing it in that config file would accomplish the right thing. No harm, on trying, I guess.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    Amy


    註冊時間: 2018/3/26
    文章: 6
    離線
    I changed the context.path and forum.link in https://github.com/sachi-d/JForumDemo/blob/master/src/main/webapp/WEB-INF/config/jforum-custom.conf.
    And changed the forum.link in SystemGlobals.properties file too.

    But now when I go to /myforum/, I'm redirected to myforum/forums/list.page but it shows nothing (I commented the CSRF filtering). It should give out something because the "templates" is is inside "/myforum/". But if I explicitly go to root/forums/list.page it shows the content (because the "templates" directory is in the root).

    The redirection is correct, but it does not read the "templates" inside "myforum". Any help please?

    The project code: https://github.com/sachi-d/JForumDemo
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    I don't think moving the templates directory is a good idea. I'm fairly certain that the code makes assumptions about where it is.

    but it shows nothing

    Anything in the log files, either JForum or server?

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    udittmer wrote:I'm fairly certain that the code makes assumptions about where it is.


    Indeed it does. It is assumed to be in the "templates" directory that is in the root directory.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    Amy


    註冊時間: 2018/3/26
    文章: 6
    離線
    udittmer wrote:
    udittmer wrote:I'm fairly certain that the code makes assumptions about where it is.


    Indeed it does. It is assumed to be in the "templates" directory that is in the root directory.


    Where is that configuration? Can I change it to set it to look inside root/myforum/
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    That is hard-coded in the JForumbaseServlet's init method class (variable defaultTemplatePath). But I doubt that changing the location of the templates directory has anything to do with this.

    Anything in the log files, either JForum or server?

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    Amy


    註冊時間: 2018/3/26
    文章: 6
    離線
    So there is no way to add jforum as a part of an existing webapp as a sub-directory? I tried adding freemarker.extra.template.path = ${application.path}/forum/templates in SytemGlobals.properties (because that was the next step in the init method after trying the default templates path). But it still returns an empty page (since I disabled CSRF - or else it just returned an error page for csrf validation).

    There were no logs recorded, I even tried adding a FileAppender in the log4j properties.
     
    討論區首頁 » User Forum
    前往:   
    行動版
    Powered by JForum 2.5.0 © 2018 JForum Team • Maintained by Andowson Chang and Ulf Dittmer