aspose file tools*
The moose likes Web Services and the fly likes URL pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "URL pattern" Watch "URL pattern" New topic
Author

URL pattern

sruti vijay
Greenhorn

Joined: Nov 18, 2012
Posts: 4
Hi,

Im trying to display url in a specific pattern like below

http://localhost:8080/projectname/packagename/method/userid.format

whereby format can be json or xml.......
and when a specific userid is given d entire details of the user will be published....

but its shows resource not available..please help...

Thanks
Sruthi
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

I believe it needs some url mapping in deployment descriptor.


Swastik
sruti vijay
Greenhorn

Joined: Nov 18, 2012
Posts: 4
here is my snippet

@Produces("application/xml")
@Path("users")
@Singleton
public class UserResource {
private TreeMap<Integer, User> userMap = new TreeMap<Integer, User>();

public UserResource(){
User user=new User();
user.setBrand("Canyon River Blues");
user.setCategory("Women's");

@GET
@Produces({"text/plain", "application/xml", "application/json", "text/xml"})
public List<User> getCustomers() {
List<User> users = new ArrayList<User> ();
users.addAll(userMap.values());
return users;
}

@GET
@Path("/aham/user/{id}")
public User getbrowdedItems(@PathParam("id") int uId) {
return userMap.get(uId);
}



and d url im expecting is "http://localhost:8080/test/user/browsedItems/userId.format"
test is the project name
entity class name is user.

Thanks
Sruthi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL pattern