Developing Roller with NetBeans

2008-06-10 Thread Java Web Development
I've played around with Roller in the past but this is my first time trying
to implement a new feature.  I'm working with Netbeans 6.1 and have to admit
the little bit of ant I learned years ago isn't helping me.

Right now, to test my changes, I modified the trunk/apps/weblogger/build.xml
to split up dist into dist-build and dist so that I don't have to build the
war file if I don't want to. (Saves some time)

I added a context.xml for the embedded tomcat server in netbeans which
points to webapps/build. I set the context to reloadable but I get SEVERE:
Error listenerStart which prevents it from restarting. So I have to then
restart tomcat.

What I want to be able to do is set up a target that will undeploy,
dist-build then redeploy with one click on the context menu. Also to be able
to do the same to debug the webapp.

It seems like things are there I just need to define some custom properties
like ${staging} but it's not clear to me where to do this.

I'm working with the sources I got from subversion a couple of days ago.

One more question, is there a page that describes how to submit patches?
This would be my first contribution back to an OS project that I didn't
start. I'm almost done and I'd be able to get up to speed with roller faster
if I could use the integrated debugger.

Thanks 




RE: Developing Roller with NetBeans

2008-06-10 Thread Java Web Development
Should have mentioned what I was working on.

I am developing the ability to display threaded comments.

So far I got the displaying part done. I added an additional attribute
subComments to WebEntryComment and the associated wrapper of type List. In
the JPAWeblogEntryManagerImpl I'm building the List that is returned so that
it returns a list of all the comments as usual but the comments that have
subComments will have their array populated. This way other parts of roller
like the atom and rss feeds will work as normal.

I split up the showEntryComments macro so I could properly do the recursion
(this gave me some problems since I'm new to velocity). 

Right now I'm working on the actual replying part. I'm trying to set up a
new method for the CommentForm called reply but I keep getting SC_NOT_FOUND
exceptions thrown. Getting the debugger working will help me get up to speed
quicker on the roller architecture.

I'm also going to need to figure out how to set it up as a configurable
parameter either in roller.properties or on a per server or per blog basis.
Any thoughts on which would be better? I think per blog might be best or it
could be configured within the theme.





Problem Implementing Threaded Comments

2008-06-11 Thread Java Web Development
I'm working on implementing threaded comments and I'm pretty much done but
in trying to clean things up I ran into a problem.

I have a form I'm using to submit the reply request.

  
  
  


If I run it as is I get the roller page not found page. I haven't been able
to figure out how to attach the debugger in netbeans yet to help me trace
the problem.

The execution doesn't even get to the CommentServlet doPost method and I
haven't been able to figure out where it's failing.

If I include a hidden input field for content it works.

Anyone know where this might be failing or how to get the debugger to work
in netbeans with roller?

Thanks




RE: Problem Implementing Threaded Comments

2008-06-11 Thread Java Web Development

Ok, I'm going to answer part of my own question.  I kept trying to attach
the debugger using the process id. I switched to shared memory and it worked
right away. So I should be able to track down the problem now.

If in the future anyone is looking for similar information.

Start the tomcat server up in debug mode.
Then go to the Run menu and select Attach Debugger.
For Transport select SharedMemoryAttach
Name is : tomcat_shared_memory_id for tomcat





Threaded comments testing

2008-06-12 Thread Java Web Development
I put up my threaded comment changes in roller on a site I've been messing
around with. Please excuse the theme as it's still a work in progress as is
the rest of the site.

The threaded comments need some refinements too. You can go ahead and post
comments at
http://www.bergenjerseyforeclosures.com/blog/info/entry/test_entry_for_threa
ded_comments 

At some point I'll probably delete the whole entry.

There are some issues that need to be addressed such as should atom and rss
comment feeds be changed as well? If a subcomment is orphaned, what should
happen? 

Any comments would be appreciated.




RE: Threaded comments testing

2008-06-12 Thread Java Web Development
Sorry,

URL was too long. Try this http://tinyurl.com/6cyfa8



-Original Message-
From: Java Web Development [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 9:05 AM
To: [email protected]
Subject: Threaded comments testing

I put up my threaded comment changes in roller on a site I've been messing
around with. Please excuse the theme as it's still a work in progress as is
the rest of the site.

The threaded comments need some refinements too. You can go ahead and post
comments at
http://www.bergenjerseyforeclosures.com/blog/info/entry/test_entry_for_threa
ded_comments 

At some point I'll probably delete the whole entry.

There are some issues that need to be addressed such as should atom and rss
comment feeds be changed as well? If a subcomment is orphaned, what should
happen? 

Any comments would be appreciated.






RE: Developing Roller with NetBeans

2008-06-12 Thread Java Web Development
Thanks!

I think I can figure out how to do something similar. I got the debugger 
working and was able to track down the problem I was having. 

I managed to get things pretty streamlined but not as much as a native webapp 
project. For getting stupid css stuff just right I like that in netbeans you 
can edit a jsp or pretty much any of the web files and reload the browser 
without rebuilding or redeploying.

I'm not sure if that's even possible with velocity templates.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Beyer
Sent: Wednesday, June 11, 2008 12:09 AM
To: [email protected]
Subject: Re: Developing Roller with NetBeans

I have no idea how netbeans works, but here's what I did with Eclipse to do
some debugging and some minor hacking. I ran the full build and created a
WAR from the 'weblogger' app. I then just imported the WAR into Eclipse,
which created a web project that I could then deploy to any server. I just
dropped a 'roller-custom.properties' file in that projects resources folder,
which Eclipse build and deploys to the 'WEB-INF/classes' folder. To get
things working quickly, I used derbry by dropping it into the 'WEB-INF/lib'
folder (before creating WAR) along with the javax.mail JAR. At that point I
could run a server and debug it. From there, I just extracted the
'roller-web.jar' code into a second project and removed the JAR from the web
project and made the web project dependant on the 'roller-web' project. Then
I could hack up the roller web code as desired.

-Nathan

On Tue, Jun 10, 2008 at 2:54 PM, Java Web Development <
[EMAIL PROTECTED]> wrote:

> I've played around with Roller in the past but this is my first time trying
> to implement a new feature.  I'm working with Netbeans 6.1 and have to
> admit
> the little bit of ant I learned years ago isn't helping me.
>
> Right now, to test my changes, I modified the
> trunk/apps/weblogger/build.xml
> to split up dist into dist-build and dist so that I don't have to build the
> war file if I don't want to. (Saves some time)
>
> I added a context.xml for the embedded tomcat server in netbeans which
> points to webapps/build. I set the context to reloadable but I get SEVERE:
> Error listenerStart which prevents it from restarting. So I have to then
> restart tomcat.
>
> What I want to be able to do is set up a target that will undeploy,
> dist-build then redeploy with one click on the context menu. Also to be
> able
> to do the same to debug the webapp.
>
> It seems like things are there I just need to define some custom properties
> like ${staging} but it's not clear to me where to do this.
>
> I'm working with the sources I got from subversion a couple of days ago.
>
> One more question, is there a page that describes how to submit patches?
> This would be my first contribution back to an OS project that I didn't
> start. I'm almost done and I'd be able to get up to speed with roller
> faster
> if I could use the integrated debugger.
>
> Thanks
>
>
>




RE: Problem Implementing Threaded Comments

2008-06-12 Thread Java Web Development
Actually that wasn't the problem The problem is that The way netbeans knows
a comment form is being submitted and needs to be forwarded to the comment
servlet, is if the http method is post and if there is a "content"
parameter.  The #comments works fine for me.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 11:07 AM
To: [email protected]
Subject: Re: Problem Implementing Threaded Comments

You probably figured this out already, but the problem you were running 
into was that you put "#comments" at the end of the forms action url. 
you don't want to do that.  Just strip that part out and it should work.

-- Allen


Java Web Development wrote:
> I'm working on implementing threaded comments and I'm pretty much done but
> in trying to clean things up I ran into a problem.
> 
> I have a form I'm using to submit the reply request.
>  name="commentForm">
>   
>   
>/>
> 
> 
> If I run it as is I get the roller page not found page. I haven't been
able
> to figure out how to attach the debugger in netbeans yet to help me trace
> the problem.
> 
> The execution doesn't even get to the CommentServlet doPost method and I
> haven't been able to figure out where it's failing.
> 
> If I include a hidden input field for content it works.
> 
> Anyone know where this might be failing or how to get the debugger to work
> in netbeans with roller?
> 
> Thanks
> 
> 




RE: Developing Roller with NetBeans

2008-06-12 Thread Java Web Development

> How to contribute to Roller
> http://cwiki.apache.org/confluence/x/2hsB
>
> Does that answer your questions about submitting patches?

Yeah that helps. I guess my main question is what exactly is a patch? Is it
just the output from svn diff? Do I run it from the root roller directory or
specifically in webapps or does it not matter? Then do I just post it here?




RE: Problem Implementing Threaded Comments

2008-06-12 Thread Java Web Development
I added the #comments because the link in the theme says "comments [N]" so
it made sense to send the browser to the comments section so they won't have
to scroll down through the entry.

One other user experience thing I came across that I didn't like.  When a
user is done previewing and posts their comment, after the comment is saved
CommentServlet uses a RequestDispatcher to forward back to the entry page. 

I would prefer it to be an HttpServletResponse redirect. You can't just
issue a redirect at that point since it seems some headers have already been
written. Anyone know if there's a method of issuing a redirect? Might be
able to do a forward to the RedirectServlet, then let RedirectServlet do the
redirect but this seems a bit inefficient.

This may be a small thing but on very popular blogs, I have seen users post
their comments and then sit and hit reload every so often to see if there's
been a response.  Doing a redirect would minimize the risk of having the
user submit the same comment twice.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 5:09 PM
To: [email protected]
Subject: Re: Problem Implementing Threaded Comments

ahhh, i know why, it's because we use the servlet path rather than the 
URI, so #comments wasn't included in the servlet path.  either way, you 
don't need that in there.

you are correct that the method must be POST and it must contain a 
request parameter for "content" in order for the request to get passed 
to the CommentServlet.


Java Web Development wrote:
> Actually that wasn't the problem The problem is that The way netbeans
knows
> a comment form is being submitted and needs to be forwarded to the comment
> servlet, is if the http method is post and if there is a "content"
> parameter.  The #comments works fine for me.
> 
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 12, 2008 11:07 AM
> To: [email protected]
> Subject: Re: Problem Implementing Threaded Comments
> 
> You probably figured this out already, but the problem you were running 
> into was that you put "#comments" at the end of the forms action url. 
> you don't want to do that.  Just strip that part out and it should work.
> 
> -- Allen
> 
> 
> Java Web Development wrote:
>> I'm working on implementing threaded comments and I'm pretty much done
but
>> in trying to clean things up I ran into a problem.
>>
>> I have a form I'm using to submit the reply request.
>> > name="commentForm">
>>   
>>   
>>value=" Reply "
>> />
>> 
>>
>> If I run it as is I get the roller page not found page. I haven't been
> able
>> to figure out how to attach the debugger in netbeans yet to help me trace
>> the problem.
>>
>> The execution doesn't even get to the CommentServlet doPost method and I
>> haven't been able to figure out where it's failing.
>>
>> If I include a hidden input field for content it works.
>>
>> Anyone know where this might be failing or how to get the debugger to
work
>> in netbeans with roller?
>>
>> Thanks
>>
>>
> 
> 




RE: unzip and run

2008-06-12 Thread Java Web Development
That seems like a good idea but I have some concerns. Primarily because the
roller-webapp.war file is already 25M (mostly because of the 3rd party jars)
and adding the server on top of that might turn some people off. 

I feel there are three main types of users to target. Those that want to
simply use roller for a blog, those that want to setup a blog site and those
that want to extend roller.

For those that want to evaluate it for use the simplest thing would be to
point them to jroller and have them create a free account. 

For those that want to view the maintenance side of things maybe apache can
host a demo site so people can play around with configuring weblogger and
planet. Then every night clean the slate.

For those that want to extend roller I think it would be nice to split up
roller up into 3 projects and a 3rd party library folder that can easily be
integrated into Netbeans and Eclipse. I haven't used Eclipse for a couple of
years so I'll give the Netbeans example. 

 * A lib directory for all the 3rd party jars
 * A Java Library Project for classes common to 
   both weblogger and planet 
 * A Web Project for weblogger that pulls in the 
   3rd party jars it needs from the lib folder and 
   is dependant on the common Java Library Project
 * A Web Project for planet that pulls in jars and 
   depends on the library project as well.

Since both Sun and IBM use roller maybe they can get their IDE people to
help do this? I started out developing java in notepad and vi and other text
editors but ever since NB 5 I can't see going back. When I need to I can
still run the nb ant scripts from the command line.

In the case of the problem I was having, I googled for over an hour trying
to understand Roller's architecture to see what classes process the request
before it gets to CommentServlet and came up empty. After figuring out how
to properly attach the debugger it took a minute to find out that
WeblogRequestMapper was where I was hitting a problem.

NetBeans does a superb job at giving developers a single install that gets
them up and running developing webapps quickly. Rather than trying to
replicate that just for roller, integrate roller better in Netbeans (and
Eclipse) for those that want to make enhancements. 

I'm not sure what Roller offers that Word Press doesn't, but I can think of
a lot of stuff in WordPress that would make me favor it over Roller. The big
draw for me is that it's written in Java and I'm looking into starting a
project that includes blogs that will be written in Java/JSP. I think that
most people that choose Roller for the same reasons and the easier it is to
get started developing Roller the better.


-Original Message-
From: Jeffrey Blattman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 12:38 PM
To: [email protected]
Subject: unzip and run

would it make sense to have a roller+[tomcat|glassfish|...] unzip and  
run bundle available on the download site? this seems to be the way  
things are going ... for eval purposes anyway.

i was able to create a roller deploy-and-go WAR pretty easily from  
the 5-min install. then we could of course create a unzip and run by  
bundling roller and the web container, w/ roller.war in the  
container's autodeploy folder.

thoughts?




RE: unzip and run

2008-06-12 Thread Java Web Development
Matt,

Security is one of the reason I prefer java over php. And believe it or not 
performance too. I use my own web framework and I get really good performance. 
Add in the fact that I can offload some work onto threads and the user 
experience gets even better. I think you can add threads in php now since php5 
but I don't really like php. The php libraries also feel like an inconsistent 
mess compared to java libraries.

I didn't mean to come off so negative. I like Roller and I chose it because I 
feel it's the best java blog software out there and I did look at a few. My 
hope is that the roller community can grow even more, especially now that it's 
an apache project. With a larger community it can get even better. Two things I 
think Roller needs are better integration with popular IDE's and more themes.

With Sun's support of Roller I'm really surprised that in the couple of years 
since I first looked at Roller, the ant scripts haven't been modified to be 
more NetBeans friendly. I can probably brush up my ant skills and hobble 
together some changes but I imagine someone on the NetBeans could make the 
changes and Roumen Strobl could put up a screencast while I'm still scratching 
my head.

I'd much rather focus my efforts on some of the features I'm better capable of 
handling. Some of the things I plan on doing for a  project that might be of 
benefit to others are the threaded comments I'm almost done with, the ability 
to install themes from the admin interface, hopefully a utility that can 
convert other public themes if possible. I wrote a dictionary based captcha 
servlet that supports internationalization that is configurable and pretty 
lightweight that I'd like to add as an option for a comment authenticator. 
There was an open source java one I found but from what I remember it was a pig 
and seemed to have a memory leak. 

I think people are working on OpenID integration but it would be nice if Roller 
was like blogger.com where you could choose how you are identified. Account 
management for users that only comment would be good to have and it looks like 
the current work done in user permissions should help enable that. One big 
thing I don't like, if I'm logged in as the blog owner, why do I have to enter 
info to place a comment. Roller should know me and themes can choose to 
highlight my comments. More importantly it shouldn't allow someone to try and 
impersonate me. Depending on what happens with that project I might have to 
implement some of these myself and don't mind giving back the code.

My one biggest gripe with roller now is it's memory footprint. I have one blog 
running without planet and the RSS for my tomcat instance went from 45M with 
just my app on it to 140M after I deployed roller-weblogger.war.

I don't know how much has to do with caching that I need to configure for a 
small, single blog site but there seem to be an awful lot of jars. Are all 
three spring, struts and guice really necessary? Why both freemaker and 
velocity? There are 18M worth of jars.


-Original Message-
From: Matt Raible [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 8:42 PM
To: [email protected]
Subject: Re: unzip and run

On Thu, Jun 12, 2008 at 6:22 PM, Java Web Development
<[EMAIL PROTECTED]> wrote:
> That seems like a good idea but I have some concerns. Primarily because the
> roller-webapp.war file is already 25M (mostly because of the 3rd party jars)
> and adding the server on top of that might turn some people off.
>
> I feel there are three main types of users to target. Those that want to
> simply use roller for a blog, those that want to setup a blog site and those
> that want to extend roller.
>
> For those that want to evaluate it for use the simplest thing would be to
> point them to jroller and have them create a free account.
>
> For those that want to view the maintenance side of things maybe apache can
> host a demo site so people can play around with configuring weblogger and
> planet. Then every night clean the slate.
>
> For those that want to extend roller I think it would be nice to split up
> roller up into 3 projects and a 3rd party library folder that can easily be
> integrated into Netbeans and Eclipse. I haven't used Eclipse for a couple of
> years so I'll give the Netbeans example.
>
>  * A lib directory for all the 3rd party jars
>  * A Java Library Project for classes common to
>   both weblogger and planet
>  * A Web Project for weblogger that pulls in the
>   3rd party jars it needs from the lib folder and
>   is dependant on the common Java Library Project
>  * A Web Project for planet that pulls in jars and
>   depends on the library project as well.
>
> Since both Sun and IBM use roller maybe they can get their IDE people to
> 

RE: unzip and run

2008-06-12 Thread Java Web Development
> Do you really care about disk space? With terabyte hard drives only being a
> few hundred bucks, what's a hundred MBs? I'm sure we could use JarJar to
> create a single JAR that's 10 MB, but I think there's bigger fish to fry. I
> agree it's rather large, but I have 1 GB of space for $20/month, so it
> doesn't bother me. If it really bothers you, the best way to get it fixes is
> to come up with a proposal for fixing and implement it. I'm sure we'd be
> happy to accept your contribution.

I think I wasn't clear. The disk space isn't the issue, it's the 95M of memory 
extra in tomcat that roller is using. Like I said, it might be that I need to 
trim down the cache to reflect the size of this particular site. But from what 
I understand and have seen, the libraries you include in your web app increase 
the amount of memory tomcat uses.  Most hosting companies don't care how much 
bandwidth or diskspace you use because in most cases users only dream of even 
using 1/4 of their allowed bandwidth. Memory and CPU is what causes them 
headaches. Now with virtualization technologies becoming more popular it gives 
them the opportunity to regulate it. This is why it's harder to find good 
affordable java hosting vs php hosting. 

I got gigs worth of memory to play with but it bugs me to see other people 
choosing something written in another technology over java when the java 
implementation is better. Just because some person decided to include a big jar 
file, only to use one class they could have written themselves in a dozen 
lines. 

With a blog, the more smaller individual users using it, the better for 
everyone. 




RE: Ipof comments

2008-06-13 Thread Java Web Development
There is an attribute in WeblogEntryComment for remoteHost. If you're
running behind apache http server and you're not doing dns lookups, which is
the default, remoteHost will be the ip address. So in many cases calling
getRemoteHost() will give you the ip address. 

Where exactly are you trying to get the ip address?




RE: unzip and run

2008-06-13 Thread Java Web Development
> Maven builds would be my preference. I could then generate Eclipse artifacts
> - the world doesn't revolve around Netbeans. Also, I think it would help
> distinguish the separation of the projects (JARs).
>
> -Nathan

I said there should be better IDE integration in general. I only singled out 
NetBeans in the examples because that's what I use the most. If Roller moves to 
Maven instead of ant then I hope that goals can be set up to easily deploy, 
debug and profile using the IDE's Maven plugin.

Maven might actually be better suited to separate the different components but 
I thought that recommending a few changes to the existing build system would be 
more reasonable in the short term.




RE: Threaded comments testing

2008-06-13 Thread Java Web Development
> Nice! I'm looking forward to seeing a patch ;-)
> 
> - Dave

Dave,

The mechanics of posting and replying to comments and the ability to turn on
this feature on a per weblog basis are done except for one issue and one
optimization I need to verify I can safely make.

Right now I'm working on comment management to reflect the changes.
Basically, if a comment has replies, what happens to those replies if that
comment is marked as spam or deleted. So we don't end up with orphaned
comments the changes should either cascade through the rest of the thread or
the replies need to be promoted one level.

Doing one of those is pretty easy. Giving the moderator a choice a little
bit harder but doable. I'm still trying to familiarize myself with this
section and haven't decided what to do yet. Do you (or anyone else) have any
thoughts on whether cascading changes, promoting replies or giving the
moderator the option would be the best way to implement it?

Also, I need to alter two tables with a new column. It looks like I have to
insert a velocimacro for each in 400-to-410-migration.vm I can't seem to
find the velocimacro definitions so can you confirm the following.

To add a varchar column to a table that can be null I need to use
#addColumnNull("" "" "varchar(48)")

To add a boolean column to a table with a default value of false
#addColumnNotNull("" "" $db.BOOLEAN_SQL_TYPE
$db.BOOLEAN_FALSE)

Does that look right?






RE: Ipof comments

2008-06-17 Thread Java Web Development

The macros that control the comments are in
trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm

The loops that go through the comments define #comment as the identifier so
you should be able to do #comment.remoteHost

-Original Message-
From: Boris Milikič [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2008 3:53 AM
To: [email protected]
Subject: RE: Ipof comments

 In template. I can't find any macro to get it.

Boris

-Original Message-
From: Java Web Development [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2008 9:39 PM
To: [email protected]
Subject: RE: Ipof comments

There is an attribute in WeblogEntryComment for remoteHost. If you're
running behind apache http server and you're not doing dns lookups, which is
the default, remoteHost will be the ip address. So in many cases calling
getRemoteHost() will give you the ip address. 

Where exactly are you trying to get the ip address?