[Logo] JForum - Powering Communities
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Members] Member Listing   [Groups] Back to home page 
[Moderation Log] Moderation Log   [Register] Register /  [Login] Login 


JForum 2.5.0 released, download it from here.
How to add jforum in sub-directory in webapp  RSS feed
Forum Index » User Forum
Author Message
Amy


Joined: 2018/3/26
Messages: 6
Offline
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


    Joined: 2013/2/21
    Messages: 217
    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


    Joined: 2018/3/26
    Messages: 6
    Offline
    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


    Joined: 2013/2/21
    Messages: 217
    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


    Joined: 2018/3/26
    Messages: 6
    Offline
    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


    Joined: 2013/2/21
    Messages: 217
    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


    Joined: 2013/2/21
    Messages: 217
    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


    Joined: 2018/3/26
    Messages: 6
    Offline
    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


    Joined: 2013/2/21
    Messages: 217
    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


    Joined: 2018/3/26
    Messages: 6
    Offline
    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.
     
    Forum Index » User Forum
    Go to:   
    Mobile view
    Powered by JForum 2.5.0 © 2018 JForum Team • Maintained by Andowson Chang and Ulf Dittmer