RESTful services on AEM

I am attempting to uncover some RESTfull webservices on AEM. I have taken after the guidelines in this blog. The following is my administration class. Basic solicitations like/helloservice/sayhi works superbly, however the technique that take way parameter and question parameters (/withparameter/{userid} and/query?q=xyz&prod=abc) return 404 blunder page. If you don't mind help me with this.

I am utilizing AEM 5.6 and Java 7

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import com.foo.bar.service.SampleResource;

@Service
@Component(metatype=true)
@Path("/helloservice")
public class SampleResourceImpl implements SampleResource{

    @GET
    @Path("/sayhi")
    @Produces({MediaType.APPLICATION_JSON})
    public String helloWorld(){
        return "Hello World";
    }

    @GET
    @Path("/getoperation")
    @Produces({MediaType.TEXT_PLAIN})
    public String getServiceOperation(){
        return "Hello getoperation!";
    }

    @GET
    @Path("/withparameter/{userid}")
    @Produces({MediaType.TEXT_PLAIN})
    public String getWithParameter(@PathParam("userid") String userid){
        return "Path parameter : "+userid;
    }

    @GET
    @Path("/query")
    @Produces({MediaType.TEXT_PLAIN})
    public String getURLParameters(@QueryParam("q") String q, @QueryParam("prod") String prod){
        return "Query params : "+q+", "+prod;
    }

}