OK with convention plugin is possible to do code from RestAction
@Action(value="/rest/*", result...@result(name=BaseAction.SUCCESS, location="/WEB-INF/content/rest-success.jsp")} ) public final String execute() { System.out.println(); System.out.println("PARENT : " + getParentPath()); System.out.println("RESOURCE : " + getResourceName()); //examine http method and other stuff return HttpBaseAction.SUCCESS; } now the requestURI returns /contextPath/rest/folder1/folder2/folder3/file1 contextPath is fixed length OK rest is annotated (is possible access without reflection? may be from the current ActionContext?) ???? getParentPath returns folder1/folder2/folder3 (from /* to last /) OK getResourceName file1 Here is the fast code for getParentPath() and getResourceName() [UNSOLVED the Action current name] protected String getRequestURI() { String uri = getRequest().getRequestURI(); return (uri.charAt(uri.length() - 1) == '/') ? uri.substring(0,uri.length() - 1) : uri; } protected String getParentPath() { String parentPath = getRequestURI().substring(getContextPath().length(),getRequestURI().lastIndexOf('/')); if (parentPath.length() < 1) parentPath = "/"; return parentPath; } protected String getResourceName() { String resourceName = getRequestURI().substring(getContextPath().concat(getParentPath()).length()); return resourceName.charAt(0) == '/' ? resourceName.substring(1) : resourceName; } On Tue, Dec 23, 2008 at 6:45 AM, Luis Gervaso <luis.gerv...@gmail.com>wrote: > I have been trying to figure the solution, > > I'm using convention plugin and i need to map first every first child of > http://www.domain.com/myapp/restController/<http://www.domain.com/myapp/restController/resource1/resource2/resource3/resource4/resource5>to > a "restaction" > > so > > > http://www.domain.com/myapp/restController/fileSystem/folder1/folder2/folder3/file1 > > http://www.domain.com/myapp/restController/fileSystem/folder1/folder2/folder3/file2 > > both to FileSystemRestController (which inherit from > AbstractRestController) > > AND > > http://www.domain.com/myapp/restController/roles/user1/role1/subrole1 > http://www.domain.com/myapp/restController/roles/user2/role1/subrole1 > http://www.domain.com/myapp/restController/roles/user3/role1/subrole2 > > both to RolesRestController > > these are just an example > > the main purpose of this is be able to use > > curl -X POST > http://www.domain.com/myapp/restController/roles/user1/role1/subrole1/othermorerole > > and create othermorerole under > http://www.domain.com/myapp/restController/roles/user1/role1/subrole1 > > > > > On Tue, Dec 23, 2008 at 3:05 AM, Luis Gervaso <luis.gerv...@gmail.com>wrote: > >> I'm wondering why not the behaviour of the rest plugin is ... >> >> *For example* >> >> URL: >> http://www.domain.com/myapp/restController/resource1/resource2/resource3/resource4/resource5 >> >> creates a mapping parent & child >> >> i.e: >> >> parentId: resource1/resource2/resource3/resource4 >> childId: resource5 >> >> these can be obtained from request URI >> >> now in the logic of the RestController we are aware to map these ids >> (really paths) with the model >> >> ParentObject - getFrom(parentId) >> ChildObject - getFrom(childId) >> >> This way to create new rest services we have to extend this base class >> >> *Another example* >> >> >> http://www.domain.com/myapp/restController/resource1/resource2/resource3/resource4/editNew >> >> parentId : resource1/resource2/resource3/resource4 >> childId: a new ModelObject from the specific restController (which extends >> BaseRestController) >> >> *The create method * >> >> uses the post request parameters for the child >> uses the url to locate the parent >> >> I have put here childId or parentId, BUT really are ChildPath or >> ParentPath (the ids are for databases) >> >> if we need to use this concept may be more appropiate to use the term >> "Reference" >> >> Thanks for readme >> >> Luis >> -- >> ------------------------------------------- >> Luis Alberto Gervaso Martin >> Java EE Architect & Instructor >> C/ Cuenca 4A, 2ºB >> Getafe (Madrid) >> SPAIN >> mobile: (+34) 627983344 >> luis.gerv...@gmail.com >> > > > > -- > ------------------------------------------- > Luis Alberto Gervaso Martin > Java EE Architect & Instructor > C/ Cuenca 4A, 2ºB > Getafe (Madrid) > SPAIN > mobile: (+34) 627983344 > luis.gerv...@gmail.com > -- ------------------------------------------- Luis Alberto Gervaso Martin Java EE Architect & Instructor C/ Cuenca 4A, 2ºB Getafe (Madrid) SPAIN mobile: (+34) 627983344 luis.gerv...@gmail.com