SessionsResource { @PUT @Path("/{session-id}/variables") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateSessionVariables(@PathParam("session-id") String sessionId, Map<String, Object> variables) { if (LOG.isDebugEnabled()) { LOG.debug("Client sent a update session variables request for a session : " + sessionId); } Response response = null; try { initializeContext(); JerseyResourceDelegateContextKey<String> sessionIdKey = JerseyResourceDelegateContextKey.valueOf(sessionIdKeyName, String.class); context.put(sessionIdKey, sessionId); JerseyResourceDelegateContextKey<Map> variablesMapKey = JerseyResourceDelegateContextKey.valueOf(variablesKeyName, Map.class); context.put(variablesMapKey, variables); response = JerseyResourceDelegateUtil.runJerseyResourceDelegate( new UpdateSessionVariablesDelegate(), application, context, LOG); } catch (Throwable e) { LOG.error(e.getMessage(), e); response = ResourcesUtil.createExceptionResponse(null, e.getMessage()); } return response; }  @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response createNewSession(NewSessionRequest request); @DELETE @Path("/{session-id}") Response removeSession(@PathParam("session-id") String sessionId); @GET @Path("/{session-id}/variables") @Produces(MediaType.APPLICATION_JSON) Response getAllSessionVariables(@PathParam("session-id") String sessionId); @PUT @Path("/{session-id}/variables") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateSessionVariables(@PathParam("session-id") String sessionId, 
      Map<String, Object> variables);  }
@Test public void testUpdateSessionVariables() throws Exception { NewSessionRequest request = new NewSessionRequest(); request.setUserName("tajo-user"); NewSessionResponse response = restClient.target(sessionsURI) .request().post(Entity.entity(request, MediaType.APPLICATION_JSON), NewSessionResponse.class); assertNotNull(response); assertTrue(response.getId() != null && !response.getId().isEmpty()); Map<String, String> variablesMap = new HashMap<String, String>(); variablesMap.put("variableA", "valueA"); variablesMap.put("variableB", "valueB"); Map<String, Map<String, String>> variables = new HashMap<String, Map<String, String>>(); variables.put("variables", variablesMap); Response restResponse = restClient.target(sessionsURI) .path("/{session-id}/variables").resolveTemplate("session-id", response.getId()) .request().put(Entity.entity(variables, MediaType.APPLICATION_JSON)); assertNotNull(restResponse); assertEquals(Status.OK.getStatusCode(), restResponse.getStatus()); Map<String, Map<String, String>> retrievedVariables = restClient.target(sessionsURI) .path("/{session-id}/variables").resolveTemplate("session-id", response.getId()) .request().get(new GenericType<Map<String, Map<String, String>>>(Map.class)); assertNotNull(retrievedVariables); assertFalse(retrievedVariables.isEmpty()); Map<String, String> retrievedVariablesMap = retrievedVariables.get("variables"); assertNotNull(retrievedVariablesMap); assertFalse(retrievedVariablesMap.isEmpty()); assertTrue(retrievedVariablesMap.containsKey("variableA")); assertTrue(retrievedVariablesMap.containsKey("variableB")); assertTrue("valueA".equals(retrievedVariablesMap.get("variableA"))); assertTrue("valueB".equals(retrievedVariablesMap.get("variableB"))); }