Package com.sun.jersey.api.core

Examples of com.sun.jersey.api.core.HttpRequestContext


   
    @Test
    public void itInjectsTheUserPrincipalFromTheRequest() throws Exception {
      final WesabeUser user = mock(WesabeUser.class);
     
      final HttpRequestContext request = mock(HttpRequestContext.class);
      when(request.getUserPrincipal()).thenReturn(user);
     
      final HttpContext context = mock(HttpContext.class);
      when(context.getRequest()).thenReturn(request);
     
      assertThat(provider.getValue(context), is(user));
View Full Code Here


     */
    private Map<String,List<String>> prepareParameters() {
        Map<String,List<String>> parameters = new HashMap<String,List<String>>();

        log.debug("Preparing parameters...");
        HttpRequestContext request = this.httpContext.getRequest();
        // Parameters for a GET request
        MultivaluedMap<String,String> queryParameters = request.getQueryParameters();
        log.debug("... {} query parameters found", queryParameters.size());
        for (Entry<String,List<String>> e : queryParameters.entrySet()) {
            parameters.put(e.getKey(), e.getValue());
        }
        // Parameters for a POST request with content-type
        // application/x-www-form-urlencoded
        MultivaluedMap<String,String> formParameters = request.getFormParameters();
        log.debug("... {} form urlencoded parameters found", formParameters.size());
        for (Entry<String,List<String>> e : formParameters.entrySet()) {
            parameters.put(e.getKey(), e.getValue());
        }
        log.debug("Parameters prepared");
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.core.HttpRequestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.