axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nurhan Berk (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AXIS2-5647) Hierarchical RESTful resources support
Date Mon, 14 Jul 2014 14:56:06 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-5647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14060713#comment-14060713
] 

Nurhan Berk commented on AXIS2-5647:
------------------------------------

Here is a PATCH containing implementation which enables custom dispatcher definition for REST
request (messages). 
The custom dispatcher class must be added to the Axis2 CLASSPATH. 
Also more than one dispatcher could be provided as is done for SOAP messages. 
Definition must be made in axis2.xml. 
An example with two dispatcher classes is given below.

         <parameter name="restDispatchers">
		<dispatcher class="org.apache.axis2.rest.FirstDispatcher" />
		<dispatcher class="org.apache.axis2.rest.SecondDispatcher" />
         </parameter>

         In the example the provided FirstDispatcher and SecondDispatcher will be called in
the right order they are defined 
(actually their invoke methods will be called), for the current case first the FirstDispatcher.invoke
() 
and then the SecondDispatcher.invoke () method will be called. Each dispatcher may terminate
the chain and prevent the 
next dispatcher(s) call by returning InvocationResponse.SUSPEND or InvocationResponse.ABORT
in its “invoke” method.
You could check the tests provided with the PATCH.


Notes:

•	The dispatchers will be applied only on incoming REST requests. 
•	If the axis2.xml does not contain “restDispatchers” definition, the old (previous)
functionality will be applied. So you are not obliged to provide dispatchers, it is back compatible.
•	The custom dispatcher classes must extend org.apache.axis2.engine.AbstractDispatcher class.
•	The dispatcher(s) could be added explicitly calling AxisConfiguration’s setRestMessagesDispatchers(List<AbstractDispatcher>)
method.
•	The PATCH is intended for http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk



> Hierarchical RESTful resources support 
> ---------------------------------------
>
>                 Key: AXIS2-5647
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5647
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel, wsdl
>    Affects Versions: 1.6.2
>            Reporter: Samuel Alexander Gnanaraj
>             Fix For: 1.6.2
>
>         Attachments: Order.wsdl2
>
>
> REST resources can be like the below
> HTTP GET http:/www.example.com/customer/{customerID}
> HTTP GET http:/www.example.com/customer/{customerID}/orders/{orderID}/
> HTTP GET 
> http:/www.example.com/customer/{customerID}/orders/{orderID}/orderitem/{itemnumber}
> Customer Details can be fetched using the first resource. Order details of a specific
customer can be fetched using second resource. Item details of a specific order of a customer
can be fetched using last resource.
> Corresponding WSDL with these operations are attached (Customer.wsdl2)
> While executing the above service (Created an aar with System.out.println in skeleton),
the last resource is executed successfully. But while executing the first two resources, “String
index out of range” exception is thrown. 
> During the service deployment Axis2 builds the HTTP Location Table for the above service
as follows.
> GET/customer	- AxisOperation Object of OrderItem
> GET/orders	 - AxisOperation Object of OrderItem
> GET/orderitem - AxisOperation Object of OrderItem
> This is because Axis2 removes the parmeters (Dynamic variables whose values are expected
to be sent at runtime) that are declared in the whttp:location element
> To solve this HTTP Location Table has to be populated with parameters as well. In that
case the HTTP Location Table for the above service will be 
> GET/customer	 - AxisOperation Object of Customer
> GET/orders	 - AxisOperation Object of Orders
> GET/orderitem	 - AxisOperation Object of OrderItem
> And the HTTPLocationBasedDispatcher.findOperation has to find the operation based on
this populated HTTP Location Table.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message