Example usage for javax.servlet.http HttpServletRequest getParameter

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

Introduction

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

Prototype

public String getParameter(String name);

Source Link

Document

Returns the value of a request parameter as a String, or null if the parameter does not exist.

Usage

From source file:com.healthcit.analytics.dao.CouchDBDaoUtils.java

public static String getCouchViewName(HttpServletRequest request) {
    String viewName = request.getParameter(VIEW_NAME);

    if (viewName == null)
        viewName = COUCHDB_VIEW_NAME;/*from w ww  .  j a  va 2s . c  o  m*/
    return viewName;
}

From source file:org.ow2.chameleon.fuchsia.push.base.hub.dto.SubscriptionConfirmationRequest.java

private static void validateRequest(HttpServletRequest request) throws InvalidContentNotification {

    if (request.getParameter(HUB_MODE) == null || request.getParameter(HUB_TOPIC) == null
            || request.getParameter(HUB_CHALLENGE) == null || request.getParameter(HUB_LEASE_SECONDS) == null) {
        throw new InvalidContentNotification("No enough information provided");
    }/*from www  .  j  a v  a2s  . c  o  m*/
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.utils.RequestUtils.java

public static String getAndSetStringToRequest(HttpServletRequest request, String name) {
    String parameter = request.getParameter(name);
    if (parameter == null) {
        parameter = (String) request.getAttribute(name);
    }//from   w w w .j  a  v a2s.c om
    request.setAttribute(name, parameter);
    return parameter;
}

From source file:eu.europeana.core.util.web.ControllerUtil.java

public static String getParameter(HttpServletRequest request, String name) {
    String value = request.getParameter(name);
    if (value == null || value.trim().length() == 0) {
        return null;
    }//from  w  w  w  . j  ava2  s.co  m
    return value;
}

From source file:gov.nih.nci.ncicb.cadsr.common.util.SessionUtils.java

public static void setPreviousSessionValues(HttpServletRequest request) {
    String previousSessionId = request.getParameter(CaDSRConstants.PREVIOUS_SESSION_ID);
    log.error("SessionUtil.setPreviousSessionValues at :" + TimeUtils.getEasternTime());

    synchronized (sessionObjectCache) {
        log.error("SessionUtil.setPreviousSessionValues(synchronized Start) at :" + TimeUtils.getEasternTime());
        if (previousSessionId != null) {
            Map map = (Map) SessionUtils.sessionObjectCache.get(previousSessionId);
            Set keys = (Set) map.get(CaDSRConstants.GLOBAL_SESSION_KEYS);
            Map objectMap = (Map) map.get(CaDSRConstants.GLOBAL_SESSION_MAP);
            if (keys != null && objectMap != null) {
                Iterator keyIt = keys.iterator();
                while (keyIt.hasNext()) {
                    String key = (String) keyIt.next();
                    Object obj = objectMap.get(key);
                    request.getSession().setAttribute(key, obj);
                }//  w  w  w. j  av  a  2  s  .co  m
            }
            log.error(
                    "SessionUtil.setPreviousSessionValues(synchronized End) at :" + TimeUtils.getEasternTime());
        }
    }
    log.error("SessionUtil.setPreviousSessionValues end at :" + TimeUtils.getEasternTime());
}

From source file:com.github.rnewson.couchdb.lucene.util.ServletUtils.java

public static boolean getBooleanParameter(final HttpServletRequest req, final String parameterName) {
    return Boolean.parseBoolean(req.getParameter(parameterName));
}

From source file:com.mobileman.projecth.web.util.CaptchaUtil.java

static public boolean verify(HttpServletRequest request, Model model) {
    Captcha captcha = (Captcha) request.getSession().getAttribute(Captcha.NAME);
    String answer = request.getParameter("captchaAnswer");
    if (captcha.isCorrect(answer)) {
        return true;
    }//from w  w w . ja va2s  . c  om
    model.addAttribute(KEY_ERROR, true);
    return false;
}

From source file:com.belajar_filter.config.FilterBeanConfig.java

public static Filter myFilter() {
    Filter filter = new Filter() {

        private ServletContext context;

        @Override//from   w  w  w  . j  av a 2s.  c o m
        public void init(FilterConfig filterConfig) throws ServletException {
            log.debug("initiate general filter config");
            this.context = filterConfig.getServletContext();
            this.context.log("AuthenticationFilter initialized");
        }

        @Override
        public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc)
                throws IOException, ServletException {
            log.debug("execute do filter ... ");
            HttpServletResponse response = (HttpServletResponse) res;
            HttpServletRequest request = (HttpServletRequest) req;

            String getParam = request.getParameter("name");
            String urlRequest = request.getRequestURI();
            log.debug("intercept url request : " + urlRequest);
            log.debug("intercept param : " + getParam);

            if ("aji".equals(getParam)) {
                log.debug("is aji");
                fc.doFilter(req, res);
            } else {
                log.debug("is not aji");
                response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE);
            }

        }

        @Override
        public void destroy() {

        }
    };

    return filter;
}

From source file:org.jasig.cas.authentication.principal.SimpleWebApplicationServiceImpl.java

public static SimpleWebApplicationServiceImpl createServiceFrom(final HttpServletRequest request,
        final HttpClient httpClient) {
    final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE);
    final String method = request.getParameter(CONST_PARAM_METHOD);
    final String serviceToUse = StringUtils.hasText(targetService) ? targetService
            : request.getParameter(CONST_PARAM_SERVICE);

    if (!StringUtils.hasText(serviceToUse)) {
        return null;
    }//from w w  w  .  ja  v a  2  s  . c o  m

    final String id = cleanupUrl(serviceToUse);
    final String artifactId = request.getParameter(CONST_PARAM_TICKET);

    return new SimpleWebApplicationServiceImpl(id, serviceToUse, artifactId,
            "POST".equals(method) ? ResponseType.POST : ResponseType.REDIRECT, httpClient);
}

From source file:org.ow2.chameleon.fuchsia.push.base.hub.dto.ContentNotification.java

public static ContentNotification from(HttpServletRequest request) throws InvalidContentNotification {
    validateRequest(request);//  w  w  w. j  ava  2  s . c  o m
    return new ContentNotification(request.getParameter(HUB_MODE), request.getParameter(HUB_URL));
}