• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Guide on interfacing with JForum

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've recently tried to have my own Java web app interface with JForum, eg. programmatically make posts, edit posts, delete posts.
After finding only bits and pieces of info on this forum for how to do this, but nothing comprehensive, I would like to share with you a hopefully more complete set of steps for achieving this.

I used commons http-client http://jakarta.apache.org/commons/httpclient/ to simulate a http client.

[CREATING TOPIC]

You can create a new topic in JForum by entering a URL similar to this:
http://localhost:8080/jforum/jforum.page?module=posts&action=insertSave&forum_id=1&subject=new topic subject&message=This is is a new subject

You can put that URL in the browser and it will automatically create a topic in the forum with forum_id = 1, and subject = "new topic subject",
and message = "This is is a new subject".

To achieve this in a java application using Commons Http-Client, you can use the following code:



[EDITING POST]

Say you wanted to edit a post with post_id = 8 in forum with forum_id = 1, the following URL when put into the browser will do it:

http://localhost:8080/jforum/jforum.page?module=posts&action=editSave&post_id=8&forum_id=1&topic_type=0&message=A NEW CONTENT&subject=A NEW SUBJECT

To do this in java:


[DELETE TOPIC]

The following url will delete a topic with the topic_id = 5, forum_id = 1.

http://localhost:8080/jforum/jforum.page?action=doModeration&module=moderation&forum_id=1&topic_id=5&topicRemove=1&returnUrl=/jforum

To do this in java:


[LOG IN AS ADMIN]

This method will log you in as the default admin (u: Admin, p: admin):



####################################

I hope this post is useful to somebody. I also hope the code works as I had to extract bits and pieces from my files so it hasnt been through a compiler.

This may not be the best or the only way to programmatically interface with JForum, but it has worked for me.

I learnt a lot about how to communicate with JForum using Firefox's Live Http Headers (http://livehttpheaders.mozdev.org/), which shows you the headers in requests.

[originally posted on jforum.net by gambit_asdf]
 
We must storm this mad man's lab and destroy his villanous bomb! Are you with me tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic