Example usage for javax.servlet.http HttpServletRequest getParameterValues

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

Introduction

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

Prototype

public String[] getParameterValues(String name);

Source Link

Document

Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

Usage

From source file:br.com.arduinoweb.controller.AdminController.java

@RequestMapping("actions/saveProfileUser")
public ModelAndView saveUsuario(User user, HttpServletRequest request) throws SQLException {
    ModelAndView mv = new ModelAndView("redirect:/Users");
    String[] idProfile = request.getParameterValues("profileId");
    int profileId = Integer.parseInt(idProfile[0]);
    mv.addObject("Message", new UserService().SaveUser(user, profileId));
    return mv;/*from w  w  w .  j a v  a 2  s.co  m*/
}

From source file:com.devmaid.web.controller.executors.PasteCommandExecutor.java

@Override
public void execute(FsService fsService, HttpServletRequest request, ServletContext servletContext,
        JSONObject json) throws Exception {
    String[] targets = request.getParameterValues("targets[]");
    boolean crossServerFromLocalToRemote = "-1".equals(request.getParameter("crossServerOperation"));
    boolean crossServerFromRemoteToLocal = "1".equals(request.getParameter("crossServerOperation"));
    String src = request.getParameter("src");
    String dst = request.getParameter("dst");
    boolean cut = "1".equals(request.getParameter("cut"));
    List<FsItemEx> added = new ArrayList<>();
    List<String> removed = new ArrayList<>();
    if (crossServerFromLocalToRemote) {
        // If it is a cross server pasting (i.e. copying from local to
        // remote or remote to local)
        StaticFsServiceFactory staticFsServiceFactory = StaticFsServiceFactory.getInstance();
        FsService localFsService = staticFsServiceFactory.getFsService();
        FsItem remoteFsItemDest = fsService.getFsItem(dst);
        String destRemotePath = remoteFsItemDest.getFile().getAbsolutePath();
        for (String target : targets) {
            FsItem localFsItemSrc = localFsService.getFsItem(target);
            String srcLocalPath = localFsItemSrc.getFile().getAbsolutePath();
            remoteFsItemDest.scpFrom(localFsItemSrc);
            System.out.println("target: " + target + ", srcLocalPath: " + srcLocalPath + ", destRemotePath: "
                    + destRemotePath);/*from   w w w  .  j  a v a  2s.  c o m*/
        }
        //Refresh the dest
        remoteFsItemDest.refresh();
    } else if (crossServerFromRemoteToLocal) {

    } else {
        FsItemEx fsrc = super.findItem(fsService, src);
        FsItemEx fdst = super.findItem(fsService, dst);

        for (String target : targets) {
            FsItemEx ftgt = super.findItem(fsService, target);
            String name = ftgt.getName();
            FsItemEx newFile = new FsItemEx(fdst, name);
            super.createAndCopy(ftgt, newFile);
            added.add(newFile);

            if (cut) {
                ftgt.delete();
                removed.add(target);
            }
        }
    }

    json.put("added", files2JsonArray(request, added));
    json.put("removed", removed);
}

From source file:gsn.http.ac.ParameterSet.java

Vector getValuesForParam(String paramname, HttpServletRequest req) {
    String values[] = req.getParameterValues(paramname);
    Vector vector = new Vector();
    if (values != null) {
        for (int i = 0; i < values.length; i++) {
            vector.add(values[i]);//from  w w  w .  j  a v a 2s .  c o m
        }
    }
    return vector;

}

From source file:com.surevine.alfresco.audit.listeners.ImmediateArchiveAuditEventListener.java

@Override
protected void populateSecondaryAuditItems(List<Auditable> events, HttpServletRequest request,
        HttpServletResponse response, JSONObject postContent) throws JSONException {
    final String[] nodeRefs = request.getParameterValues(AlfrescoJSONKeys.NODEREF);

    if (request.getParameter("path") == null && nodeRefs.length > 1) {
        for (int i = 1; i < nodeRefs.length; i++) {
            Auditable primaryEvent = events.get(0);

            AuditItem item = new AuditItem();

            setGenericAuditMetadata(item, request);

            item.setAction(ACTION);/*ww  w .  ja  v a2 s .  c  o m*/

            setMetadataFromNodeRef(item, nodeRefResolver.getNodeRefFromGUID(nodeRefs[i]));
            item.setDetails(primaryEvent.getDetails());

            events.add(item);
        }
    }
}

From source file:com.springmvc.controller.TimeLogController.java

@RequestMapping(value = "/selection")
public String selection(Model model, HttpServletRequest request) throws IOException {

    String message = "";

    if (request.getParameterValues("selection") == null) {
        model.addAttribute("pageTitle", "TimeLogs");
        model.addAttribute("pageDescription",
                "List of all login sessions and durations <br>You can sort and delete time logs as well");
        model.addAttribute("type", "danger");
        message = "Please make a selection before deleting";
        model.addAttribute("message", message);
        model.addAttribute("timelogs", timeLogService.getTimeLogs());
        return "timelog_list";
    } else {//from  ww w.  j ava 2  s . c o  m
        String[] selectedTimeLogIds = request.getParameterValues("selection");
        for (String s : selectedTimeLogIds) {
            timeLogService.deleteTimeLog(Integer.parseInt(s));
        }
        message = "Selected logs succesfully deleted.";
    }

    model.addAttribute("pageTitle", "TimeLogs");
    model.addAttribute("pageDescription",
            "List of all login sessions and durations <br>You can sort and delete time logs as well");
    model.addAttribute("timelogs", timeLogService.getTimeLogs());
    model.addAttribute("message", message);
    model.addAttribute("type", "success");

    return "timelog_list";
}

From source file:br.com.arduinoweb.controller.AdminController.java

@RequestMapping("actions/saveProfilePage")
public ModelAndView savaProfilePage(HttpServletRequest request, Profile profile) throws SQLException {
    ModelAndView mv = new ModelAndView("redirect:/ProfilePage");
    String id[] = request.getParameterValues("pageId");
    mv.addObject("Message", new ProfileService().ChangeProfile(profile, id));
    return mv;// w  w w . j  av a  2 s. c o m
}

From source file:org.osmsurround.ae.osm.OsmUpdateController.java

@RequestMapping(value = "/osmUpdate", method = RequestMethod.GET)
public @ResponseBody List<Amenity> get(BoundingBox boundingBox, HttpServletRequest request) {

    List<Amenity> amenities = osmUpdateService.getOsmDataAsAmenities(boundingBox);
    osmUpdateService.startUpdateThread(new ArrayList<Amenity>(amenities));

    String[] show = request.getParameterValues("show");
    String[] hide = request.getParameterValues("hide");

    nodeFilterService.filterAmenitiesForUser(amenities, new FilterSet(show, hide));
    return amenities;
}

From source file:net.duckling.ddl.web.api.pan.APIPanShareController.java

/**
 * // w  ww.j  a  va2 s  .  co  m
 * @param request
 * @return
 */
@ResponseBody
@RequestMapping(params = "func=delete")
@SuppressWarnings("unchecked")
public JSONObject deleteShareResource(HttpServletRequest request) {
    String[] rs = request.getParameterValues("ids[]");
    int[] ids = new int[rs.length];
    for (int i = 0; i < rs.length; i++) {
        ids[i] = Integer.parseInt(rs[i]);
    }
    for (int id : ids) {
        panShareResourceService.delete(id);
    }
    JSONObject obj = new JSONObject();
    obj.put("success", true);
    return obj;
}

From source file:org.esgf.globusonline.GlobusOnlineDownloadController.java

/**
 * queryStringInfo(HttpServletRequest request)
 * Private method that prints out the contents of the request.  Used mainly for debugging.
 * /* w ww  . ja va  2s  .c o m*/
 * @param request
 */
private void queryStringInfo(HttpServletRequest request) {

    LOG.debug("Query parameters");
    LOG.debug("\tId");
    LOG.debug("\t\t" + request.getParameterValues("id")[0]);
    LOG.debug("\tType");
    LOG.debug("\t\t" + request.getParameterValues("type")[0]);
    LOG.debug("\tChild urls");
    for (int i = 0; i < request.getParameterValues("child_url").length; i++) {
        LOG.debug("\t\t" + request.getParameterValues("child_url")[i]);
    }
    LOG.debug("\tChild ids");
    for (int i = 0; i < request.getParameterValues("child_id").length; i++) {
        LOG.debug("\t\t" + request.getParameterValues("child_id")[i]);
    }

}

From source file:com.vmware.lightwaveui.Login.java

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 *///from w w  w.  j  a v  a  2  s . c  o m
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    try {
        String[] tenant = request.getParameterValues("tenant");
        String tenantName = "";
        if (tenant != null && tenant.length > 0) {
            tenantName = tenant[0];
        }
        if (tenantName == null || tenantName == "") {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No tenant specifed.");
            return;
        }
        tenantName = tenantName.toLowerCase();
        String uri = request.getRequestURL().toString();
        String protocol = uri.split("://")[0];
        String hostname = uri.split("://")[1].split("/")[0];
        String client_id = getClientId(tenantName);
        String redirect_uri = protocol + "://" + hostname + "/lightwaveui/Home";
        String openIdConnectUri = protocol + "://" + hostname + "/openidconnect/oidc/authorize/" + tenantName;
        String args = "?response_type=id_token%20token&response_mode=form_post&client_id=" + client_id
                + "&redirect_uri=" + redirect_uri
                + "&state=_state_lmn_&nonce=_nonce_lmn_&scope=openid%20rs_admin_server%20rs_vmdir";
        String authorizeUri = openIdConnectUri + args;
        response.sendRedirect(authorizeUri);
    } catch (Exception exc) {
        String message = " Message: " + exc.getMessage();
        String querystring = "?" + request.getQueryString();
        String uri = request.getRequestURL().toString();
        response.getWriter().append("Error: ").append(uri + querystring + message);
    }
}