This is follow-up info to the things that I discussed here:
http://cxf.547215.n5.nabble.com/Basic-Http-Demo-and-the-refactoring-that-I-did-in-the-course-of-figuring-out-how-it-worked-td4389413.html

and here:
http://cxf.547215.n5.nabble.com/demo-jaxrs-server-CustomInvoker-td4389484.html

------------------------------------------------
Custom Invoker:
------------------------------------------------
Here is the terminal output from the Server which has registered a
CustomInvoker.

The registration was done in Server.java

here:

Server.java
--------------------------------------------------------------------------------------------------------
...
sf.setInvoker(new CustomInvoker());
...
--------------------------------------------------------------------------------------------------------

and here is the new output:

mvn -Pserver
--------------------------------------------------------------------------------------------------------

There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] >>> exec-maven-plugin:1.2:java (default) @ jax_rs_basic >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2:java (default) @ jax_rs_basic <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2:java (default) @ jax_rs_basic ---
product 323
product 324
product 325
May 12, 2011 3:18:08 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:9000/
May 12, 2011 3:18:09 AM org.eclipse.jetty.util.log.Slf4jLog info
INFO: jetty-7.3.1.v20110307
May 12, 2011 3:18:09 AM org.eclipse.jetty.util.log.Slf4jLog info
INFO: Started SelectChannelConnector@localhost:9000
May 12, 2011 3:18:09 AM org.eclipse.jetty.util.log.Slf4jLog info
INFO: started o.e.j.s.h.ContextHandler{,null}
Server ready...

***
The method about to be invoked
by the CustomInvoker
is named
--->  getCustomerByID
***

----invoking getCustomer, Customer id is: 123

***
The method about to be invoked
by the CustomInvoker
is named
--->  getOrder
***

----invoking getOrder, Order id is: 223
----invoking getProduct with id: 323

***
The method about to be invoked
by the CustomInvoker
is named
--->  getOrder
***

----invoking getOrder, Order id is: 224
----invoking getProduct with id: 324

***
The method about to be invoked
by the CustomInvoker
is named
--->  getOrder
***

----invoking getOrder, Order id is: 225
----invoking getProduct with id: 325

***
The method about to be invoked
by the CustomInvoker
is named
--->  updateCustomer
***

----invoking updateCustomer, Customer name is: Mary

***
The method about to be invoked
by the CustomInvoker
is named
--->  addCustomer
***

----invoking addCustomer, Customer name is: Jack
Server exiting
S:\cxf\distribution\src\main\release\samples\jax_rs\basic>
--------------------------------------------------------------------------------------------------------


I thought that the firewall and administrative settings on this Windows
operating system would prevent me from printing this, but it turns out
that I was incorrect about that.



------------------------------------------------
Client output with refactoring:
------------------------------------------------
Also, so that you can see the results of the refactoring that I mentioned,
I have also included the client output here:

mvn -Pclient
--------------------------------------------------------------------------------------------------------

[INFO] Scanning for projects...
...
[INFO] --- exec-maven-plugin:1.2:java (default) @ jax_rs_basic ---
Sent HTTP GET request to query customer info
http://localhost:9000/customerservice/customers/123
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Customer><id>123</id><na
me>John</name></Customer>




Sent HTTP GET request to query sub resource product info
http://localhost:9000/customerservice/orders/223/products/323
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Product><description>pro
duct 323</description><id>323</id></Product>


Sent HTTP GET request to query sub resource product info
http://localhost:9000/customerservice/orders/224/products/324
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Product><description>pro
duct 324</description><id>324</id></Product>


Sent HTTP GET request to query sub resource product info
http://localhost:9000/customerservice/orders/225/products/325
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Product><description>pro
duct 325</description><id>325</id></Product>




Sent HTTP PUT request to update customer info
Response status code: 200
Response body:



Sent HTTP POST request to add customer
Response status code: 200
Response body:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Customer><id>124</id><na
me>Jack</name></Customer>


S:\cxf\distribution\src\main\release\samples\jax_rs\basic>
--------------------------------------------------------------------------------------------------------


This was the output from the code that I showed, or at least approximately.
I mention
this because in my most recent iteration of changing the Client, I have been
printing
the url contents and url headers explicitly. This helped me figure out more
about
what seems to be the equivalence of an HTTP GET Request and a simple
openURLConnection to, what else, a url.

Ryan

Reply via email to