This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I get response back from rest service

 
Mark Curlette
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to get a response back from rest service, but it gave me a http 404 error saying " The requested resource (/RestSimpleApp/orders/1) is not available."

My code looks like this





My web.xml is




I call my code from the IE browser window as :

http://localhost:8080/RestSimpleApp/orders/1

and it gave me


Http status 404 on /RestSimpleApp/orders/1
description The requested resource (/RestSimpleApp/orders/1) is not available.

I don't know what is going on? please give me some hint if you can.

Thanks so much in advance.

Tom

 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to not use a variable in your @Path declaration? Like @Path("foo") and then hit the url : /RestSimpleApp/orders/foo. If that works, it means you have set up everything correctly, and you either cannot use a parameter in the @Path declaration or you are not doing it correctly.
 
Mark Curlette
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Emanuel,
I don't understand what you meant. Could you please elaborate?

Thanks!
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code right now:



URL you're trying: /RestSimpleApp/orders/1

My suggestion:



URL to try: /RestSimpleApp/orders/foo
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also try this URL: /RestSimpleApp/orders/foo?testid=1
 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from your web.xml



Are you not forgetting something? See url-pattern.
 
Mark Curlette
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I tried both URLS : /RestSimpleApp/orders/foo and URL: /RestSimpleApp/orders/foo?testid=1
for sample code, but it still gave me "The requested resource (/RestSimpleApp/orders/foo) is not available " error




I even tried to add / to Path("/foo") but it still did not work.


 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should it not be
http://localhost:8080/RestSimpleApp/rest/orders/1 ? with your original code not with foo.
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Do the following change and then try



instead of



Hope you got the point.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic