2013-10-07 103 views
0

有没有办法获得用于访问restlet的协议?例如,当通过HTTPS访问servlet时,我会实现类似于稍微不同的行为。我怎样才能检查这个?从restlet获取Jersey协议

回答

0

显然,你可以注入你的HttpServletRequest的要求是这样的:

@PUT 
@Path("{storage}/{repository}/{path:.*}") 
public void upload(@PathParam("storage") String storage, 
        @PathParam("repository") String repository, 
        @PathParam("path") String path, 
        @Context HttpServletRequest request) 
     throws IOException, 
       AuthenticationException 
{ 
    System.out.println("Using protocol " + request.getRequestURL().toString().split(":")[0]); 
} 

,这将这样的伎俩。