コード例 #1
0
 @GET
 @Path("/get2/{tt}")
 public void get1(@Context HttpHeaders hh) {
   MultivaluedMap<String, String> headerParams = hh.getRequestHeaders();
   Map<String, Cookie> cookieMap = hh.getCookies();
   for (Map.Entry<String, List<String>> entry : headerParams.entrySet()) {
     System.out.printf(
         "headers + " + entry.getKey() + "value" + Arrays.toString(entry.getValue().toArray()));
   }
   for (Map.Entry<String, Cookie> entry : cookieMap.entrySet()) {
     System.out.printf("cokie key " + entry.getKey() + entry.getValue().getPath());
   }
 }
コード例 #2
0
 @GET
 @Path("/get1/{dd}")
 public void get(@Context UriInfo ui) {
   MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
   MultivaluedMap<String, String> pathParams = ui.getPathParameters();
   for (Map.Entry<String, List<String>> entry : pathParams.entrySet()) {
     System.out.println(
         "path: key-" + entry.getKey() + " value-" + Arrays.toString(entry.getValue().toArray()));
   }
   for (Map.Entry<String, List<String>> entry : queryParams.entrySet()) {
     System.out.println(
         "query: key-" + entry.getKey() + " value-" + Arrays.toString(entry.getValue().toArray()));
   }
 }
コード例 #3
0
 @POST
 @Path("/get1/{yy}")
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 public void get(MultivaluedMap<String, String> paramsMap) {
   for (Map.Entry<String, List<String>> entry : paramsMap.entrySet()) {
     System.out.println(entry.getKey() + " " + Arrays.toString(entry.getValue().toArray()));
   }
 }