Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

REST(Jersey + Jetty).. Why my jetty server says 404 when i have that URL

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I searched this forum.. found a similar topic but not the answer...

Case: I am implementing a REST framework with Jersey.. My server is Jetty..
Link: The base of my implementation and problem...How do i create an embedded Jetty instance that uses Jersey

Alright, now the exception thrown..

I have a DataBean, Resource class and a Jetty class which creates a jetty instance based on the above link..
Below is the launch method in Jetty class:

com.n2bb.srm.web.resource.. this package has my resource class

Client code in a different project:

Why is my server responding with 404 not found error... What am i doing wrong ??

Thank you very much...
 
Anish Shah
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK.. somehow i got it to work..

Change i made..



to



Now i don't get this ?? I am not able to find my correct path..

What would happen if i have to add multiple servlets... the /* would already have loaded everything...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the /* would already have loaded everything...


... which suggests that mapping a servlet to "/..." is not generally a good idea.
 
Anish Shah
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

the /* would already have loaded everything...


... which suggests that mapping a servlet to "/..." is not generally a good idea.



OK.. i tried every other combination to find the actual URL..
I tried...
/
/srm
/srm/
srm/ --- exception
/*srm
/*srm*
/srm*
" " -- blank..

Only /* works which means it loads everything

Now what if i want to add a new servlet down the line...
Something like


Now i already have

Whats going to happen in this scenario...

Also.. off the topic..
Every Servet container(like Jetty in my case) can support a max of 1 ServletContext right ??

Thank you...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic