java - restful service: I created a dynamic web page where I used @QueryParams over a few methods
for example, http://localhost:7001/students/get?id=1
will return the student's details with the id value of 1
Great...
I've built also a readme.html file that I'm trying to present once the client is accessing the web page
localhost:7001/students
= supposed to see a readme.html file....
My problem is (first of all) that I got no idea how things work in the web.xml file.
(second of all) my readme file wont show up!
I found the cause of the problem and it is in the <url-pattern></url-pattern>
Odd thing is that when I set it to <url-pattern>/*</url-pattern>
My functions work, for example, once I hit the URL http://localhost:7001/students/get?id=1
I get my output
But when I hit http://localhost:7001/students/
theres no readme, just blank screen :(
AND when I change the url pattern to - <url-pattern>students</url-pattern>
for example
I can see my readme at the url - http://localhost:7001/students/
but my functions wont work I get a 404 error :(
my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>students</display-name>
<welcome-file-list>
<welcome-file>readme.html</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>students</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>students</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>students</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Thanks in advance for any reply, will really appreciate a solution, Iguana.