2011-10-04 12 views
10

ile alma Sunucumun temel URL'sini JAX-RS ile nasıl alabilirim? Program yerel bir sunucudayken ve "http: //www.theSite.com/..." program canlı bir sunucudayken temelde "" http: // localhost: 8080/.. "istiyorum.Sunucumun temel URL'sini JAX-RS

@Path("myresource") 
public class MyResource{ 

    @Context 
    UriInfo uri; 

    @GET 
    public String myresponse(){ 
    URI myUri = uri.getBaseUri(); 
    return ... 
    } 
} 

sen UriInfo ile bilgiler bol olacak.:. Eğer Uri nesne olsun nasıl Jersey Çerçeve @Context UriInfo ait

cevap

4

Kullanım getBaseUri()