Example usage for javax.servlet.http HttpServletRequest getParameterMap

List of usage examples for javax.servlet.http HttpServletRequest getParameterMap

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getParameterMap.

Prototype

public Map<String, String[]> getParameterMap();

Source Link

Document

Returns a java.util.Map of the parameters of this request.

Usage

From source file:org.toobsframework.pres.util.ParameterUtil.java

public static Map buildParameterMap(HttpServletRequest request, boolean compCall) {
    Map params = new HashMap();
    HttpSession session = request.getSession();
    Enumeration attributes = session.getAttributeNames();
    // Session has lowest priority
    while (attributes.hasMoreElements()) {
        String thisAttribute = (String) attributes.nextElement();
        //if (session.getAttribute(thisAttribute) instanceof String) {
        params.put(thisAttribute, session.getAttribute(thisAttribute));
        //}//w w  w .  ja v a 2 s .c  om
    }
    // Parameters next highest
    params.putAll(request.getParameterMap());

    // Attributes rule all
    attributes = request.getAttributeNames();
    while (attributes.hasMoreElements()) {
        String thisAttribute = (String) attributes.nextElement();
        if (!excludedParameters.contains(thisAttribute)) {
            if (log.isDebugEnabled()) {
                log.debug("Putting " + thisAttribute + " As " + request.getAttribute(thisAttribute));
            }
            params.put(thisAttribute, request.getAttribute(thisAttribute));
        }
    }
    params.put("httpQueryString", request.getQueryString());
    if (compCall && request.getMethod().equals("POST")) {
        StringBuffer qs = new StringBuffer();
        Iterator iter = request.getParameterMap().entrySet().iterator();
        int i = 0;
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            String key = (String) entry.getKey();
            String[] value = (String[]) entry.getValue();
            for (int j = 0; j < value.length; j++) {
                if (i > 0)
                    qs.append("&");
                qs.append(key).append("=").append(value[j]);
                i++;
            }
        }
        params.put("httpQueryString", qs.toString());
    }
    return params;
}

From source file:com.cognicap.site.web.controllers.RegistrationController.java

@Override
protected boolean isFormSubmission(HttpServletRequest request) {
    return !request.getParameterMap().isEmpty();
}

From source file:net.shopxx.interceptor.ValidateInterceptor.java

private boolean isValid(HttpServletRequest request) {
    for (Object values : request.getParameterMap().values()) {
        if (values != null) {
            for (String value : (String[]) values) {
                if (!Jsoup.isValid(value, whitelist)) {
                    return false;
                }/*from w  w  w.jav  a 2s. c om*/
            }
        }
    }
    return true;
}

From source file:org.primefaces.integration.swf.PrimeFacesAjaxHandler.java

public boolean isAjaxRequest(HttpServletRequest req, HttpServletResponse resp) {
    boolean isAjax = req.getParameterMap().containsKey("primefacesPartialRequest");

    if (isAjax)//from w ww  .j  ava 2  s  .c o m
        return true;
    else
        return delegate.isAjaxRequest(req, resp);
}

From source file:com.epam.reportportal.extension.bugtracking.jira.oauth.OAuthController.java

@RequestMapping(value = "/approve", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)/* ww w  .  j a va 2 s  .  c o m*/
@ApiOperation("Get registered external system instance")
public void callback(HttpServletRequest rq) throws IOException {
    System.out.println(rq);
    rq.getParameterMap().forEach((k, v) -> System.out.println(k + ":" + v[0]));
}

From source file:com.activiti.web.rest.client.AbstractClientResource.java

protected Map<String, String[]> getRequestParametersWithoutServerId(HttpServletRequest request) {
    Map<String, String[]> parameterMap = request.getParameterMap();
    Map<String, String[]> resultMap = new HashMap<String, String[]>();
    resultMap.putAll(parameterMap);/*  www . j  a va2s  .c o m*/
    resultMap.remove(SERVER_ID);
    return resultMap;
}

From source file:com.cradiator.TeamCityStatusPlugin.BuildMonitorController.java

private boolean requestHasParameter(HttpServletRequest request, String parameterName) {
    return request.getParameterMap().containsKey(parameterName);
}

From source file:com.neu.controller.APIController.java

@RequestMapping(value = "/apicall.htm", method = RequestMethod.POST, headers = "Accept=*/*", produces = "application/json")
@ResponseStatus(HttpStatus.OK)//from   w w  w.  j  ava 2  s.  c  o  m
public @ResponseBody String searchresult(HttpServletRequest request) throws Exception {
    Map pmap = request.getParameterMap();
    System.out.println("in drugsearch controller");
    String action = request.getParameter("action");
    String urlRestWebService = "https://ussouthcentral.services.azureml.net/workspaces/168eb4a3d72e4b078160213fcdaa4333/services/ee080088b48141e0af10c9913067689d/execute?api-version=2.0&details=true";
    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization",
            "Bearer AJacooh+WG4WeJTntLNn/E3A3E4yQELYY8S6/2sbpcsBvNFSCabuopvuiqlnrd47a0qBf4Coj1LMcEhBUm0Ujw==");
    headers.add("Content-Length", "100000");
    headers.add("Content-Type", "application/json");

    String requestJson = "{'Inputs': {'input1': {'ColumnNames': [ 'drugname','route','dose_amt','dose_unit','dose_form', 'dose_freq','mfr_sndr','pt'],'Values':[['"
            + pmap.get("drugname") + "','" + pmap.get("reactionlist") + "','" + pmap.get("doseform") + "','"
            + pmap.get("doseunit") + "','" + pmap.get("dosefreq") + "','" + pmap.get("mfndetails") + "','"
            + pmap.get("route") + "','" + pmap.get("doseamt") + "']]}},'GlobalParameters': {}}";

    HttpEntity<String> entity = new HttpEntity<String>(requestJson, headers);
    System.out.println("entity" + entity);
    RestTemplate restTemplate = new RestTemplate();

    String restData = restTemplate.postForObject(urlRestWebService, entity, String.class);

    ObjectMapper mapper = new ObjectMapper();
    mapper.enable(SerializationConfig.Feature.INDENT_OUTPUT);
    mapper.writeValue(System.out, restData);

    //            Drugs drug=new Drugs("AZ","sn");
    return mapper.writeValueAsString(restData);
}

From source file:com.example.securelogin.app.common.filter.InputValidationFilter.java

private void validateRequestParams(HttpServletRequest request) {
    Map<String, String[]> params = request.getParameterMap();
    for (Map.Entry<String, String[]> entry : params.entrySet()) {
        validate(entry.getKey(), prohibitedChars);
        for (String value : entry.getValue()) {
            validate(value, prohibitedChars);
        }/*  ww w  . jav  a  2  s. c  om*/
    }
}

From source file:edu.wisc.my.stats.web.support.WritableHttpServletRequestWrapper.java

/**
 * @param request/*from w  ww  . j  a v a 2s. c  om*/
 */
@SuppressWarnings("unchecked")
public WritableHttpServletRequestWrapper(HttpServletRequest request) {
    super(request);
    this.parameters.putAll(request.getParameterMap());
}