Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.too.webservice;
- import javax.ws.rs.ApplicationPath;
- import org.glassfish.jersey.server.ResourceConfig;
- @ApplicationPath("")
- public class ApplicationConfig extends ResourceConfig {
- public ApplicationConfig() {
- super(ApplicationConfig.class);
- packages("org.too.webservice");
- }
- }
- /////////////////////////////////////////////////////////////////////////
- package org.too.webservice;
- import javax.inject.Inject;
- import javax.ws.rs.GET;
- import javax.ws.rs.Path;
- import javax.ws.rs.QueryParam;
- @Path("service")
- public class ServiceResource {
- @Inject
- private AccountService accountService;
- @GET
- @Path("/account/get")
- public String getAccount(@QueryParam("id") String id) {
- return accountService.get(id).toString();
- }
- }
- /////////////////////////////////////////////////////////////////////////
- package org.too.webservice;
- import javax.inject.Singleton;
- @Singleton
- public class AccountService {
- public String get(String id) {
- return "New Account with Id = " + id;
- }
- }
- /////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement