[jboss-dev-forums] [JBoss ESB Development] - httprouter issues with GET/POST WADL Services and Web Routing

Dave Siracusa do-not-reply at jboss.com
Sun May 16 09:47:37 EDT 2010


Dave Siracusa [http://community.jboss.org/people/davesiracusa] created the discussion

"httprouter issues with GET/POST WADL Services and Web Routing"

To view the discussion, visit: http://community.jboss.org/message/543285#543285

--------------------------------------------------------------
I ran into two issues when using the httprouter (new):
1) Using this router one must specify the method (get,post,delete, etc) in the configuration tree.  If you route to an external server that supports both GET and POST you are stuck because the method factory is created at init time forcing you to use only one.  I've run into this with a RESTful service I'm pointing to.

2) Say you point the router to a web server that serves up a page.  This page contains relative links to images.  The text/html content comes back however the images/other content does not.  As a matter of fact you can't specify anything after the base url, its ignored.

And my router as such:
<action name="httprouter">   
<property name="endpointUrl" value=" http://localhost/ http://localhost">   
<http-client-property name="max-total-connections" value="100" />   
<http-client-property name="max-connections-per-host" value="50" />   
</property>   
<property name="method" value="GET" />  
<property name="responseType" value="STRING" />
</action>

Urls like this succeed (partially):
-  http://localhost:8080/Quickstart_async/http/test http://localhost:8080/Quickstart_async/http/test (returns text/html only).

Urls like this fail (even though they exist):
-  http://localhost:8080/Quickstart_async/http/test/index.htm http://localhost:8080/Quickstart_async/http/test/index.htm
-  http://localhost:8080/Quickstart_async/http/test/welcome.png http://localhost:8080/Quickstart_async/http/test/welcome.png

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I changed the httprouter source:
1) I added support for comma separated method value (GET,POST,DELETE).  It creates factories in the init() method, caching it as the original author intended. 
2) I added a call to method.setPath in the process method to initialize the path and all is good.

I've attached the source.  

BTW - I'm having problems signing the CLA.  I've opened discussions on this.  
I'd like to create a JIRA and check in my changes.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/543285#543285]

Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2032]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100516/1658950e/attachment.html 


More information about the jboss-dev-forums mailing list