[Geoserver-devel] A little lost with OWS dispatcher

Hi (hi Justin :-)),
I've successfully manage to expose with VersionedWebFeatureService
thru OWS, but it has been a little of trial and error.

First, I could not find the documentation about the new OWS dispatch
system. It seems it's here: http://docs.codehaus.org/display/GEOSDOC/4+Modules but it's not linked
by the devel guide afaik.

Then, http://docs.codehaus.org/display/GEOSDOC/2+Http shows quite a bit
of details, but looking at the spring context configuration in WFS module shows there is a lot more, such as URLmappers (nice touch the
logging aspect on the wfs service, btw). I think this should be documented as well, maybe using WFS as an example.

Finally, a question: why is the dispatcher servlet configured to serve specific url in web.xml (such as wcs/*, wms/* and so on) and I have
to specify more or less the same information when url-mapping a service?

That is:

-- web.xml: ---------------------------------------------------------
  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/wfs/*</url-pattern>
   </servlet-mapping>

--- wfs applicationContext.xml ----------------------------------------
<!-- http url mapping -->
  <bean id="wfsURLMapping"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="interceptors">
      <list>
        <ref bean="citeComplianceHack"/>
      </list>
    </property>
  
    <property name="mappings">
      <props>
        <prop key="/wfs">dispatcher</prop>
        <prop key="/wfs/*">dispatcher</prop>
      </props>
    </property>
  </bean>

It would make more sense to me to have the OWS dispatcher as the last
element in the servlet mappings, and have it handle all urls instead.
Why configuring a service in two places? Plus, having to change web.xml
makes adding a service not really drop jar and play.

Cheers
Andrea

Hi Andrea,

Sounds like you are having fun!!

Andrea Aime wrote:

Hi (hi Justin :-)),
I've successfully manage to expose with VersionedWebFeatureService
thru OWS, but it has been a little of trial and error.

First, I could not find the documentation about the new OWS dispatch
system. It seems it's here:
http://docs.codehaus.org/display/GEOSDOC/4+Modules but it's not linked
by the devel guide afaik.

Then, http://docs.codehaus.org/display/GEOSDOC/2+Http shows quite a bit
of details, but looking at the spring context configuration in WFS
module shows there is a lot more, such as URLmappers (nice touch the
logging aspect on the wfs service, btw). I think this should be
documented as well, maybe using WFS as an example.

Yes, the documentation is out of date. I am making a jira task against
1.6 to make sure that documentation is up to date. Now that the
dispatcher is finalized, it would be a good time to write the "how to
write a service tutorial" ( a somewhat advanced version ), and include
all the stuff like url mapping, logging with aspects ( which i am glad
you like btw :slight_smile: ), etc..

Finally, a question: why is the dispatcher servlet configured to serve
specific url in web.xml (such as wcs/*, wms/* and so on) and I have
to specify more or less the same information when url-mapping a service?

Two things. The first is I forgot to remove them when i ported changes
from ows branch ;). The second is one I haven't really solved yet and it
relates to the struts action servlet. With the following mapping:

  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/*</url-pattern>
   </servlet-mapping>

The dispatcher gets mapped to everything, including the struts action
servlet. Try as hard as i may, i have not been able to figure out how to
get sprint to properly forward to struts. It is easy to configure the
disaptcher to do so, but when an actual request comes it, the struts
action servlet ends up looking for a bunch of stuff in the servlet
context that is not there due to the fact that it is not mapped as a
servlet directly... despite being an example in the spring docs!!
Perhaps i can try again. There are new versions of spring and struts out
there, perhaps an upgrade will fix the problem.

I also tried this mapping:

  <servlet-mapping>
     <servlet-name>ows</servlet-name>
  <url-pattern>*.do</url-pattern>
   </servlet-mapping>
  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/*</url-pattern>
   </servlet-mapping>

But it still doesn't work. The dispatcher ends up gobbling up all he
requests. Anyways, its been a while since i looked at it, perhaps a
fresh set of eyes will do some good.

That is:

-- web.xml: ---------------------------------------------------------
  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/wfs/*</url-pattern>
   </servlet-mapping>

--- wfs applicationContext.xml ----------------------------------------
<!-- http url mapping -->
  <bean id="wfsURLMapping"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="interceptors">
      <list>
        <ref bean="citeComplianceHack"/>
      </list>
    </property>
  
    <property name="mappings">
      <props>
        <prop key="/wfs">dispatcher</prop>
        <prop key="/wfs/*">dispatcher</prop>
      </props>
    </property>
  </bean>

It would make more sense to me to have the OWS dispatcher as the last
element in the servlet mappings, and have it handle all urls instead.
Why configuring a service in two places? Plus, having to change web.xml
makes adding a service not really drop jar and play.

Agreed, this one little minor detail makes having a dynamic dispatcher
kind of useless. Scheduling a jira for it.

Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:1004,45e40d69243511804284693!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira ha scritto:

Hi Andrea,

Yes, the documentation is out of date. I am making a jira task against
1.6 to make sure that documentation is up to date. Now that the
dispatcher is finalized, it would be a good time to write the "how to
write a service tutorial" ( a somewhat advanced version ), and include
all the stuff like url mapping, logging with aspects ( which i am glad
you like btw :slight_smile: ), etc..

Cool

Finally, a question: why is the dispatcher servlet configured to serve specific url in web.xml (such as wcs/*, wms/* and so on) and I have
to specify more or less the same information when url-mapping a service?

Two things. The first is I forgot to remove them when i ported changes
from ows branch ;). The second is one I haven't really solved yet and it
relates to the struts action servlet. With the following mapping:

  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/*</url-pattern>
   </servlet-mapping>

The dispatcher gets mapped to everything, including the struts action
servlet. Try as hard as i may, i have not been able to figure out how to
get sprint to properly forward to struts.

Oh hum... I thought servlet mapping were executed in the order they
were declared. If this is true, then it's enough to declare the
dispatcher mapping as the last one. With a quick seeach I cannot confirm
this being a rule unfortunately...

It is easy to configure the
disaptcher to do so, but when an actual request comes it, the struts
action servlet ends up looking for a bunch of stuff in the servlet
context that is not there due to the fact that it is not mapped as a
servlet directly... despite being an example in the spring docs!!
Perhaps i can try again. There are new versions of spring and struts out
there, perhaps an upgrade will fix the problem.

I also tried this mapping:

  <servlet-mapping>
     <servlet-name>ows</servlet-name>
  <url-pattern>*.do</url-pattern>
   </servlet-mapping>
  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/*</url-pattern>
   </servlet-mapping>

But it still doesn't work.

Ouch....

The dispatcher ends up gobbling up all he
requests. Anyways, its been a while since i looked at it, perhaps a
fresh set of eyes will do some good.

Hmm. I'll try and remember having a look at this.

That is:

-- web.xml: ---------------------------------------------------------
  <servlet-mapping>
     <servlet-name>dispatcher</servlet-name>
  <url-pattern>/wfs/*</url-pattern>
   </servlet-mapping>

--- wfs applicationContext.xml ----------------------------------------
<!-- http url mapping -->
  <bean id="wfsURLMapping"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="interceptors">
      <list>
        <ref bean="citeComplianceHack"/>
      </list>
    </property>
  
    <property name="mappings">
      <props>
        <prop key="/wfs">dispatcher</prop>
        <prop key="/wfs/*">dispatcher</prop>
      </props>
    </property>
  </bean>

It would make more sense to me to have the OWS dispatcher as the last
element in the servlet mappings, and have it handle all urls instead.
Why configuring a service in two places? Plus, having to change web.xml
makes adding a service not really drop jar and play.

Agreed, this one little minor detail makes having a dynamic dispatcher
kind of useless. Scheduling a jira for it.

Nice, thank you.
Cheers
Andrea