• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I get response back from rest service

 
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also try this URL: /RestSimpleApp/orders/foo?testid=1
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
should it not be
http://localhost:8080/RestSimpleApp/rest/orders/1 ? with your original code not with foo.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Do the following change and then try



instead of



Hope you got the point.
reply
    Bookmark Topic Watch Topic
  • New Topic