Example usage for javax.servlet.http HttpServletRequest getQueryString

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

Introduction

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

Prototype

public String getQueryString();

Source Link

Document

Returns the query string that is contained in the request URL after the path.

Usage

From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java

@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.DELETE)
public void deleteContainer(HttpServletRequest req, HttpServletResponse resp) {
    try {/*from   w  w  w . j  ava2s.co m*/
        this.api.delete(req, resp);
    } catch (Exception e) {
        log.error("Failed to delete container " + req.getQueryString(), e);
        resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:com.ebay.pulsar.metric.controller.PulsarReportingController.java

@SuppressWarnings("rawtypes")
@RequestMapping(value = "pulsar/metriccalculator", method = RequestMethod.GET)
public ResponseEntity viewMetricCalculator(HttpMethod method, HttpServletRequest request,
        HttpServletResponse response) throws URISyntaxException {
    URI url = new URI("http", null, MetricCalculator, MetricCalculatorPort, MetricCalculatorPath,
            request.getQueryString(), null);
    ResponseEntity<String> responseEntity = restTemplate.exchange(url, method, HttpEntity.EMPTY, String.class);
    return responseEntity;
}

From source file:com.bt.aloha.batchtest.ultramonkey.Servlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    LOG.debug(request.getPathInfo() + ":" + request.getQueryString());
    Properties resultProperties = new Properties();
    resultProperties.put("local.host.name", request.getLocalName());
    resultProperties.put("local.host.port", Integer.toString(request.getLocalPort()));
    resultProperties.put("remote.host.name", request.getRemoteHost());
    resultProperties.put("remote.host.port", Integer.toString(request.getRemotePort()));
    resultProperties.put("makeCall.count", Integer.toString(makeCallCount));
    resultProperties.put("terminateCall.count", Integer.toString(terminateCallCount));
    resultProperties.put("incomingCall.count", Integer.toString(((ServiceImpl) service).getIncomingCount()));
    String result = "something or rather";
    String resultKey = "callid";
    if (request.getPathInfo().equalsIgnoreCase("/makecall")) {
        makeCallCount++;//from w w  w.ja  v  a  2s  .co m
        String caller = request.getParameter("caller");
        String callee = request.getParameter("callee");
        result = this.service.makeCall(caller, callee);
    } else if (request.getPathInfo().equalsIgnoreCase("/terminatecall")) {
        terminateCallCount++;
        String callid = request.getParameter("callid");
        service.terminateCall(callid);
        result = callid;
    } else if (request.getPathInfo().equalsIgnoreCase("/reset")) {
        makeCallCount = 0;
        terminateCallCount = 0;
        ((ServiceImpl) service).setIncomingCount(0);
    } else if (request.getPathInfo().equalsIgnoreCase("/status")) {
        result = "Sample SpringRing web application";
        resultKey = "status";
    } else {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }
    resultProperties.put(resultKey, result);
    resultProperties.store(response.getOutputStream(), "Response generated on:");
}

From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java

@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.GET)
public void getDepositReceiptOrStatement(HttpServletRequest req, HttpServletResponse resp) {
    try {//from   www. j  av  a  2s.co  m
        this.api.get(req, resp);
    } catch (Exception e) {
        log.error("Failed to get deposit receipt for " + req.getQueryString(), e);
        resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:net.big_oh.common.web.listener.request.ObservedHttpServletRequest.java

public ObservedHttpServletRequest(HttpServletRequest request) {
    super(request);

    httpMethod = request.getMethod();//ww  w  . ja  va 2  s .c om

    resourceRequested = request.getRequestURL().toString();

    queryString = request.getQueryString();

    contextName = request.getContextPath();

    containerUserName = request.getRemoteUser();

    HttpSession session = request.getSession(false);
    jSessionId = (session == null) ? null : session.getId();
}

From source file:gov.nih.nci.firebird.web.interceptor.FirebirdShowSplashPageInterceptor.java

private String getTargetUrl() {
    HttpServletRequest request = ServletActionContext.getRequest();
    StringBuffer targetUrl = new StringBuffer(request.getRequestURI());
    if (request.getQueryString() != null) {
        targetUrl.append('?');
        targetUrl.append(request.getQueryString());
    }//from www  . j a  v a2s.  co  m
    return targetUrl.toString();
}

From source file:fedora.server.security.servletfilters.FilterRestApiFlash.java

/**
 * Perform flash client response filtering
 *//*  w w  w .  j av  a2  s  .  c o  m*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
        throws IOException, ServletException {
    if (log.isDebugEnabled()) {
        log.debug("Entering FilterRestApiFlash.doThisSubclass()");
    }

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;
    String queryString = httpRequest.getQueryString();
    if (queryString != null && queryString.contains("flash=true")) {
        StatusHttpServletResponseWrapper sHttpResponse = new StatusHttpServletResponseWrapper(httpResponse);

        filterChain.doFilter(request, sHttpResponse);

        if (sHttpResponse.status != sHttpResponse.realStatus) {
            // Append the error indicator with real status
            try {
                ServletOutputStream out = sHttpResponse.getOutputStream();
                out.print("::ERROR(" + sHttpResponse.realStatus + ")");
            } catch (IllegalStateException ise) {
                PrintWriter out = sHttpResponse.getWriter();
                out.print("::ERROR(" + sHttpResponse.realStatus + ")");
            }
        }
    } else {
        filterChain.doFilter(request, response);
    }
}

From source file:org.cagrid.identifiers.namingauthority.impl.NamingAuthorityService.java

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
 *      response)//from   w w  w.  ja  v a2s  .  c om
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    LOG.debug("getPathInfo[" + request.getPathInfo() + "]");
    LOG.debug("getQueryString[" + request.getQueryString() + "]");
    LOG.debug("getRequestURI[" + request.getRequestURI() + "]");
    LOG.debug("getRequestURL[" + request.getRequestURL() + "]");
    LOG.debug("getServerName[" + request.getServerName() + "]");
    LOG.debug("getServerPort[" + request.getServerPort() + "]");
    LOG.debug("getServletPath[" + request.getServletPath() + "]");
    LOG.debug("User Identity[" + request.getAttribute(GSIConstants.GSI_USER_DN));

    processor.process(request, response);
}

From source file:com.apress.progwt.server.web.controllers.CollegeController.java

@RequestMapping(method = RequestMethod.GET)
public String collegeHandler(HttpServletRequest req, ModelMap model) throws InfrastructureException {

    log.debug("SERVLET PATH: " + req.getServletPath() + " " + req.getPathInfo() + " " + req.getQueryString());

    String path = req.getPathInfo();
    path = path.replace('_', ' ');

    String[] pathParts = path.split("/");
    log.debug("!path parts " + Arrays.toString(pathParts));

    // "/college/dartmouth" splits to [,dartmouth]
    if (pathParts.length < 2) {
        return getNotFoundView();
    }/*  w  w w . ja  v  a  2s  . c o  m*/

    String schoolName = pathParts[1];

    School school = schoolService.getSchoolDetails(schoolName);
    if (school == null) {
        model.addAttribute("message", "Couldn't find school " + schoolName);
        return getNotFoundView();
    }

    PostsList forumPosts = schoolService.getForum(school, 0, 10);
    ForumBootstrap forumBootstrap = new ForumBootstrap(serializer, forumPosts, school);
    model.addAttribute("forumBootstrap", forumBootstrap);

    model.addAttribute("school", school);
    model.addAttribute("interestedIn", schoolService.getUsersInterestedIn(school));

    ControllerUtil.updateModelMapWithDefaults(model, req, userService);

    return view;
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.datatools.dumprestore.DumpModelsAction.java

DumpModelsAction(HttpServletRequest req, HttpServletResponse resp) throws BadRequestException {
    super(req);/*www. ja v  a 2s. com*/
    this.resp = resp;
    this.which = getEnumFromParameter(WhichService.class, PARAMETER_WHICH);
    this.queryString = req.getQueryString();
}