WWWWWWWWWWWWWWWWWWWWW
W.......B...B.......W
W.......B+.+B.......W
W.......B+.+B.......W
W.......B+.+B.......W
W.......B+D+B.......W
W......rB+C+Br......W
W.......B+++B.......W
W.......B+.+B.......W
W.......B+.+B.......W
W.......B+.+B.......W
W.......B+.+B.......W
WWWWWDWWWWWWWWWDWWWWWW = Wall
. = Open
B = Drawbridge
+ = fortification
D = Door
r = restraint (chain with cat/dog/other domestic animal. Oh, and the one time I tried the GCS seemed to ignore kittens and vice versa.)
The idea is this - there is a peculiarity in the AI of things in DF: they won't attack if they can't path to their target. Even though the spider can *see* the bait, the fact that it can't reach them means it won't spit web at them. However, we correct this with another peculiarity, this time in pathfinding. Toady uses something like A* that is generally pretty good but horrible in the case where no path exists. To correct this he maintains a data structure such that the pathfinding algorithm can check if a path exists just by glancing at two tiles. The long and short of it is that there's only one such structure, not a seperate one for dwarves and pets... despite the ability to set a door to pass one but not the other. So if we have a door that a dwarf can path through but a GCS can't, the spider will see a path and attack the bait while being unable to actually reach it.
So, you build the structure in my diagram above (or the picture below it, they're the same) and have the inner door set to "allow passage" but
not "allow pets". With the bridge raised the GCS can't see the things and won't bother trying to path to them. People gathering silk can't see it and won't try to run from it. No goblin for anyone to see and/or run from. With the bridge down the GCS can see the bait and path to it, but it can't get to it. The net result will be it bumping against the door a bunch and throwing webs at the bait.
Now personally I'm paranoid so I completely forbid the outer doors when the GCS is webbing, and I tend to completely forbid the inner door when it isn't so that it won't waste a few processor cycles trying to wander through it now and then. I also have a pair of cage traps outside each outer door. It's probably all completely unnecessary and I've never had to use the traps but I tend to go "better safe then sorry". I mean, I've never had to shut off my waterfall either, but I still have the floodgates in place.
Um... I suppose all this is assuming you have a GCS and can trap it. Personally when that is the case I always do go for a silk and dyeing industry, but it might or might not *really* be worth it. I just feel bad when everyone has Xx(Pig Tail Sock)xX (or even nothing at all!) and I can do something about it. Sure, perhaps it mostly means having a dozen Xx(Pig Tail Garment)xX and one *Giant Cave Spider Silk Sock*, but I consider it better. Plus they're ridiculously valuable. Apparently there will be the ability to set a full uniform for my military in the next version, though, so this will all be valuable experience.