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:co.propack.sample.vendor.nullPaymentGateway.web.controller.NullPaymentGatewayHostedProcessorController.java

@RequestMapping(value = "/hosted/null-checkout", method = RequestMethod.POST)
public @ResponseBody String retrieveHostedEndpoint(HttpServletRequest request) {

    Map<String, String[]> paramMap = request.getParameterMap();

    String transactionAmount = "";
    String orderId = "";
    String completeCheckoutOnCallback = "true";
    String resultMessage = "Hosted Call Successful";

    if (paramMap.get(NullPaymentGatewayConstants.TRANSACTION_AMT) != null
            && paramMap.get(NullPaymentGatewayConstants.TRANSACTION_AMT).length > 0) {
        transactionAmount = paramMap.get(NullPaymentGatewayConstants.TRANSACTION_AMT)[0];
    }//from   w ww  . ja  va 2  s . co  m

    if (paramMap.get(NullPaymentGatewayConstants.ORDER_ID) != null
            && paramMap.get(NullPaymentGatewayConstants.ORDER_ID).length > 0) {
        orderId = paramMap.get(NullPaymentGatewayConstants.ORDER_ID)[0];
    }

    if (paramMap.get(NullPaymentGatewayConstants.COMPLETE_CHECKOUT_ON_CALLBACK) != null
            && paramMap.get(NullPaymentGatewayConstants.COMPLETE_CHECKOUT_ON_CALLBACK).length > 0) {
        completeCheckoutOnCallback = paramMap.get(NullPaymentGatewayConstants.COMPLETE_CHECKOUT_ON_CALLBACK)[0];
    }

    StringBuffer response = new StringBuffer();
    response.append("<!DOCTYPE HTML>");
    response.append("<!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\" lang=\"en\"> <![endif]-->");
    response.append("<!--[if IE 7]> <html class=\"no-js lt-ie9 lt-ie8\" lang=\"en\"> <![endif]-->");
    response.append("<!--[if IE 8]> <html class=\"no-js lt-ie9\" lang=\"en\"> <![endif]-->");
    response.append("<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\"> <!--<![endif]-->");
    response.append("<body>");
    response.append("<h1>Mock Hosted Checkout</h1>");
    response.append(
            "<p>This is an example that demonstrates the flow of a Hosted Third Party Checkout Integration (e.g. PayPal Express Checkout)</p>");
    response.append(
            "<p>This customer will be prompted to either enter their credentials or fill out their payment information. Once complete, "
                    + "they will be redirected back to either a confirmation page or a review page to complete checkout.</p>");
    response.append("<form action=\"" + paymentGatewayConfiguration.getHostedRedirectReturnUrl()
            + "\" method=\"GET\" id=\"NullPaymentGatewayRedirectForm\" name=\"NullPaymentGatewayRedirectForm\">");
    response.append("<input type=\"hidden\" name=\"" + NullPaymentGatewayConstants.TRANSACTION_AMT
            + "\" value=\"" + transactionAmount + "\"/>");
    response.append("<input type=\"hidden\" name=\"" + NullPaymentGatewayConstants.ORDER_ID + "\" value=\""
            + orderId + "\"/>");
    response.append("<input type=\"hidden\" name=\"" + NullPaymentGatewayConstants.COMPLETE_CHECKOUT_ON_CALLBACK
            + "\" value=\"" + completeCheckoutOnCallback + "\"/>");
    response.append("<input type=\"hidden\" name=\"" + NullPaymentGatewayConstants.RESULT_MESSAGE
            + "\" value=\"" + resultMessage + "\"/>");

    response.append("<input type=\"submit\" value=\"Please Click Here To Complete Checkout\"/>");
    response.append("</form>");
    response.append("</body>");
    response.append("</html>");

    return response.toString();
}

From source file:com.redhat.rhn.frontend.action.systems.images.ScheduleImageDeploymentAction.java

/**
 * Return true if there is only one parameter contained in the request.
 * @param request//from   www .  ja v a  2s  . c  om
 * @return true if there is only one parameter, else false
 */
private boolean loadAsync(HttpServletRequest request) {
    boolean ret = false;
    Map params = request.getParameterMap();
    if (params.size() == 1) {
        ret = true;
    }
    return ret;
}

From source file:com.thoughtworks.go.server.plugin.controller.PluginController.java

private Map<String, String> getParameterMap(HttpServletRequest request) {
    Map<String, String[]> springParameterMap = request.getParameterMap();
    Map<String, String> pluginParameterMap = new HashMap<>();
    for (String parameterName : springParameterMap.keySet()) {
        String[] values = springParameterMap.get(parameterName);
        if (values != null && values.length > 0) {
            pluginParameterMap.put(parameterName, values[0]);
        } else {//from  ww  w  .  j  ava2 s  . c o m
            pluginParameterMap.put(parameterName, null);
        }
    }
    return pluginParameterMap;
}

From source file:nl.ctrlaltdev.harbinger.filter.HttpEvidenceFilter.java

private boolean isValid(HttpServletRequest request, Evidence evidence) {
    if (validateRequestParameters) {
        for (Map.Entry<String, String[]> e : request.getParameterMap().entrySet()) {
            for (String v : e.getValue()) {
                if (!ctx.isValidParameter(evidence, e.getKey(), v)) {
                    return false;
                }/*from  www . j av a2s  .  co m*/
            }
        }
    }
    return true;
}

From source file:com.jaspersoft.jasperserver.api.metadata.user.service.impl.RequestAuthenticationProcessingFilter.java

protected Map obtainRequestParameters(HttpServletRequest request) {

    Map result = new HashMap();
    result.putAll(request.getParameterMap());

    Enumeration attrs = request.getAttributeNames();
    while (attrs.hasMoreElements()) {
        String attrName = (String) attrs.nextElement();
        result.put(attrName, request.getAttribute(attrName));
    }/* ww w. j  ava2s  .  c o m*/

    return result;
}

From source file:compare.handler.get.TableInfoHandler.java

/**
 * Handle a request to get some metadata for a document
 * @param request the http request/*from   www .j  a  v  a  2 s .  co m*/
 * @param response the response
 * @param urn the current urn (ignored)
 * @throws CompareException if loading of MVD failed
 */
public void handle(HttpServletRequest request, HttpServletResponse response, String urn)
        throws CompareException {
    Map map = request.getParameterMap();
    docid = request.getParameter(JSONKeys.DOCID);
    version1 = getStringOption(map, Params.VERSION1, "");
    String json = "{}";
    try {
        if (docid != null && docid.length() > 0) {
            EcdosisMVD mvd = loadMVD(Database.CORTEX, docid);
            String selected = getStringOption(map, Params.SELECTED, ALL);
            String baseVersion = selectVersion1(mvd, selected);
            short base = mvd.getBaseVersion(baseVersion);
            int baseLen = getBaseVersionLen(mvd, base);
            int[] offsets = mvd.measureTable(base);
            int numSegs = Math.round((float) offsets.length / (float) CHUNK);
            if (numSegs == 0)
                numSegs = 1;
            int[] segs = new int[numSegs + 1];
            if (numSegs == 2) {
                segs[0] = 0;
                segs[1] = baseLen;
            } else {
                for (int i = 0; i < numSegs; i++)
                    segs[i] = offsets[i * CHUNK];
            }
            segs[segs.length - 1] = baseLen;
            JSONArray arr = new JSONArray();
            for (int i = 0; i < segs.length; i++)
                arr.add(segs[i]);
            json = arr.toJSONString();
        } else
            throw new Exception("CORTEX mvd " + docid + " not found");
        response.setContentType("application/json;charset=UTF-8");
        response.getWriter().println(json);
    } catch (Exception e) {
        throw new CompareException(e);
    }
}

From source file:org.apereo.openlrs.model.error.XAPIErrorInfo.java

private void getDataFromRequest(final HttpServletRequest request) {
    this.path = request.getRequestURI();
    this.method = request.getMethod();
    this.parameters = request.getParameterMap();
}

From source file:com.lcw.one.modules.sys.interceptor.LogInterceptor.java

/**
 * ?/*from  w  w  w.  ja v  a2s  .  co m*/
 * @param request
 * @return
 */
private String buildQueryString(HttpServletRequest request) {
    StringBuilder params = new StringBuilder();
    int index = 0;
    for (Object param : request.getParameterMap().keySet()) {
        params.append((index++ == 0 ? "" : "&") + param + "=");
        params.append(StringUtils.abbr(StringUtils.endsWithIgnoreCase((String) param, "password") ? ""
                : request.getParameter((String) param), 100));
    }
    return params.toString();
}

From source file:org.jasig.cas.web.flow.CasDefaultFlowUrlHandler.java

@Override
public String createFlowExecutionUrl(final String flowId, final String flowExecutionKey,
        final HttpServletRequest request) {
    final StringBuffer builder = new StringBuffer();
    builder.append(request.getRequestURI());
    builder.append("?");
    appendQueryParameters(builder, request.getParameterMap(), getEncodingScheme(request));
    return builder.toString();
}

From source file:de.ifgi.mosia.wpswfs.handler.GetCapabilitiesHandler.java

@Override
public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    HttpResponse response;/* w  w  w  .  j a  va2  s .c  o  m*/
    try {
        response = executeGetCapabilities(req.getParameterMap());
    } catch (IOException e) {
        logger.warn(e.getMessage(), e);
        throw new IOException("Proxy server issue: " + e.getMessage());
    }

    filterAndWriteResponse(response.getEntity(), response.getStatusLine().getStatusCode(), resp);

}