dumb question - I need an example web.xml

13 views
Skip to first unread message

Kevin Pauli

unread,
Jul 15, 2014, 6:03:52 PM7/15/14
to unfilter...@googlegroups.com
This is probably so basic that I can't even find an example.  I've recently been learning Scala and want to explore using Unfiltered for a new set of services.

I've got a simple EchoService defined as such:

object EchoService {
    val echo = Planify {
        case Path(Seg(p :: Nil)) => ResponseString(p)
    }
    val niceError = Planify {
        case _ => ResponseString("no can do")
    }
}

I've got a manual test working like this:

object Unfiltered_MT {
    def main(args: Array[String]) {
        Http.anylocal.filter(EchoService.echo).filter(EchoService.niceError).run()
    }
}

Works great!  Now this thing (with the two chained filters) needs to be deployed as a war in WebLogic.  What I can't figure out is what the web.xml should look like to accomplish that declaratively.

Chris Lewis

unread,
Jul 15, 2014, 6:32:14 PM7/15/14
to unfilter...@googlegroups.com
Hello Kevin,

Planify from the filter module results in a filter Plan which is an instance of javax.servlet.Filter. This means that EchoService.echo and EchoService.niceError are both servlet filter instances. The problem with web.xml is that it needs a class name that it can instantiate, which you don't have as you constructed instances through Planify (which ultimately constructs instances of an anonymous subclass of Filter). So, to wire these up through web.xml, just create a class extending Plan, and then you can map that class as you normally would.


--
You received this message because you are subscribed to the Google Groups "Unfiltered" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unfiltered-sca...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-chris
Reply all
Reply to author
Forward
0 new messages