Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
13. May 2008, 03:34 CET | Link

Here's an idea for a feature that I would like to see in Seam: an annotation to create servlets. There's already a @Filter annotation, so my idea is to have something similar for Servlets.

The reason for this: I would like to be able to use the full power of Seam components, SMPC, etc, within a Servlet. Sure, Seam handles HTML output and PDF output. But sometimes I want some other entirely different type of output, like maybe I want to create an RSS feed, or display an image, or dynamically generate a sound file, or various other things.

Is this a reasonable idea? How hard would it be to implement? I might take a crack at it by looking at how @Filter works if this is a good idea.

6 Replies:
13. May 2008, 04:51 CET | Link

Why don't you create the patch and submit it to JIRA?

 

Best regards,
Joshua

Visit my blog.

13. May 2008, 06:09 CET | Link

I may do it. I'm first curious if the Seam devs have any opinions on if this is a desirable idea, or what the other potential complexities or problems with it are. I don't know much about how Seam works under the hood. In my current view, I don't see how this would be much different from the @Filter annotation implementation, so unless someone tells me that this is a pointless idea or there's some other problem, I'm going to go ahead and do it by basing it on how @Filter works.

13. May 2008, 06:16 CET | Link

By all means submit this as a feature request in JIRA. It seems to be something that would be useful for many people.

13. May 2008, 06:22 CET | Link

Ok. I'm not the only one then. I'll write the patch and submit it. My company has already signed up as a JBoss contributor so we can submit the code.

13. May 2008, 07:59 CET | Link

Sure, could be useful.

As a side note, I didn't even know it was possible to do dynamic servlets (or have I misunderstood the feature)? I though it was deployment-stuff coming soon(tm) to the servlet speces(?)

But since no-one has objected, I won't stand in your way :-)

 

If a man speaks in the forest and there is no woman around to hear him, is he still wrong?

13. May 2008, 09:31 CET | Link

Within Servlet 2.5 (the current version) there is no dynamic servlet deployment, at least not that I could see. I looked at the ServletContext API and there's nothing like a mapServlet(String path, Servlet servlet) method that would be needed for real dynamic deployment.

HOWEVER, it's not a problem. In a typical Seam environment, the Seam servlet is mapped to *.seam. Ok, cool. I can have the Seam Servlet remember to call some user-supplied Servlet with the @Servlet annotation on it if it matches some criteria. The annoyance here is that then all the Servlets will have to end in .seam in their URLs. But that's not such a problem because you could put another mapping in web.xml, and also you could go ahead and use URLrewriter to change the visible URLs anyway.

So from the Servlet side of things this will work, and it looks like I can get Seam to do its stuff also. It will take me a couple of days to do this (I have other higher priority stuff to do also).