Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- com.sun.jersey.api.client.UniformInterfaceException
- Message: GET http://localhost:8080/shumer/rest/employee/get returned a response status of 404
- <servlet>
- <servlet-name>JAX-RS Servlet</servlet-name>
- <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
- <init-param>
- <param-name>spring.autowire</param-name>
- <param-value>byName</param-value>
- </init-param>
- <load-on-startup>3</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>JAX-RS Servlet</servlet-name>
- <url-pattern>/rest/*</url-pattern>
- </servlet-mapping>
- @Path("employee")
- public class EmployeeResource {
- @Autowired
- EmpDao empDao;
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public List<Employee> get(@QueryParam("empCode") String empCode) throws Exception {
- EmpCriteria criteria = new EmpCriteria();
- criteria.setEmpCode(empCode);
- return empDao.searchByCondition(criteria);
- }
- }
- public class EmployeeClientTestAction extends Action {
- @Override
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- Client client = Client.create();
- WebResource resource = client.resource("http://localhost:8080/shumer/rest/employee/get");
- String employees= resource.accept(MediaType.APPLICATION_JSON)
- .get(String.class);
- System.out.println(employees);
- request.setAttribute("employees", employees);
- return mapping.findForward("successful");
- }
- }
- <init-param>
- <param-name>com.sun.jersey.config.property.packages</param-name>
- <param-value>shumer.rest.resource</param-value>
- </init-param>
Add Comment
Please, Sign In to add comment