Example usage for javax.servlet ServletRequest getParameter

List of usage examples for javax.servlet ServletRequest getParameter

Introduction

In this page you can find the example usage for javax.servlet ServletRequest 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.jaspersoft.jasperserver.war.util.SessionDecoratorFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    String sessionDecorator = request.getParameter(SESSION_DECORATOR);

    if (!StringUtils.isEmpty(sessionDecorator)) {
        if (request instanceof HttpServletRequest) {
            HttpSession session = ((HttpServletRequest) request).getSession();

            session.setAttribute(SESSION_DECORATOR, sessionDecorator);
        }/*from  www.  jav  a  2 s.com*/
    }

    chain.doFilter(request, response);
}

From source file:org.apache.cxf.fediz.spring.web.FederationSignOutCleanupFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    String wa = request.getParameter(FederationConstants.PARAM_ACTION);
    if (FederationConstants.ACTION_SIGNOUT_CLEANUP.equals(wa)) {
        if (request instanceof HttpServletRequest) {
            ((HttpServletRequest) request).getSession().invalidate();
        }// w w  w . j ava2  s . co m

        final ServletOutputStream responseOutputStream = response.getOutputStream();
        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("logout.jpg");
        if (inputStream == null) {
            LOG.warn("Could not write logout.jpg");
            return;
        }
        int read = 0;
        byte[] buf = new byte[1024];
        while ((read = inputStream.read(buf)) != -1) {
            responseOutputStream.write(buf, 0, read);
        }
        inputStream.close();
        responseOutputStream.flush();
    } else {
        chain.doFilter(request, response);
    }
}

From source file:cn.vlabs.umt.ui.tags.SsoParamsTag.java

public int doEndTag() throws JspException {
    ServletRequest request = pageContext.getRequest();
    JspWriter writer = pageContext.getOut();
    for (String param : Attributes.SSO_PARAMS) {
        String value = request.getParameter(param);
        if (StringUtils.isNotBlank(value)) {
            try {
                writer.println(String.format("<input type=\"hidden\" name=\"%s\" value=\"%s\">", param, value));
            } catch (IOException e) {
                throw new JspException(e);
            }/*from w w  w.  ja v a2  s .c o  m*/
        }
    }
    return EVAL_PAGE;
}

From source file:de.hybris.platform.acceleratorcms.services.impl.DefaultCMSPageContextService.java

/**
 * Retrieves {@link CMSFilter#PREVIEW_TICKET_ID_PARAM} from current request
 * /* ww w. ja va 2s .  co  m*/
 * @param request
 *           current request
 * @return current ticket id
 */
protected String getPreviewTicketId(final ServletRequest request) {
    String id = request.getParameter(CMSFilter.PREVIEW_TICKET_ID_PARAM);
    if (StringUtils.isBlank(id)) {
        id = getSessionService().getAttribute(CMSFilter.PREVIEW_TICKET_ID_PARAM);
    }
    return id;
}

From source file:org.surfnet.oaaas.auth.AbstractFilter.java

public final String getReturnUri(ServletRequest request) {
    String returnUri = (String) request.getAttribute(RETURN_URI);
    if (StringUtils.isEmpty(returnUri)) {
        returnUri = request.getParameter(RETURN_URI);
    }//from  www  . j a va 2  s . c o  m

    return returnUri;
}

From source file:org.eclipse.skalli.view.internal.filter.SearchFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    String view = request.getParameter(Consts.PARAM_VIEW);

    if (StringUtils.equals(view, Consts.PARAM_VALUE_VIEW_HIERARCHY)) {
        FilterUtil.forward(request, response, Consts.URL_HIERARCHY);
        return;/*  w  w  w. ja  v a2  s . co  m*/
    }

    super.doFilter(request, response, chain);
}

From source file:org.wso2.carbon.identity.captcha.connector.recaptcha.SelfSignUpReCaptchaConnector.java

private Property[] getConnectorConfigs(ServletRequest servletRequest) throws Exception {

    String tenantDomain = servletRequest.getParameter("tenantDomain");
    if (StringUtils.isBlank(tenantDomain)) {
        tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    }// ww w.  ja v  a  2  s  . c o  m

    Property[] connectorConfigs;
    connectorConfigs = identityGovernanceService.getConfiguration(new String[] { PROPERTY_ENABLE_RECAPTCHA },
            tenantDomain);

    return connectorConfigs;
}

From source file:org.surfnet.oaaas.auth.AbstractFilter.java

/**
 * Get the attribute value that serves as session state.
 * @param request the HttpServletRequest
 *//*  ww  w.  j ava2  s. c  o  m*/
public final String getAuthStateValue(ServletRequest request) {
    String authStateValue = (String) request.getAttribute(AUTH_STATE);
    if (StringUtils.isEmpty(authStateValue)) {
        authStateValue = request.getParameter(AUTH_STATE);
    }
    return authStateValue;
}

From source file:org.uberfire.server.locale.GWTLocaleHeaderFilter.java

private Locale getLocale(final ServletRequest request) {
    Locale locale = request.getLocale();
    final String paramLocale = request.getParameter("locale");
    if (paramLocale == null || paramLocale.isEmpty()) {
        return locale;
    }/*from   w w  w  .  j av a  2s  .  c o m*/
    try {
        locale = LocaleUtils.toLocale(paramLocale);
    } catch (Exception e) {
        //Swallow. Locale is initially set to ServletRequest locale
    }
    return locale;
}

From source file:org.jetbrains.teamcity.widgets.JsonResponseHelper.java

public void service(ServletRequest servletRequest, ServletResponse servletResponse)
        throws ServletException, IOException {

    DefaultHttpClient client = new DefaultHttpClient();
    String url = servletRequest.getParameter("url");
    //HttpGet httpget = new HttpGet("http://buildserver/guestAuth/app/rest/investigations?locator=state:TAKEN");
    HttpGet httpget = new HttpGet("http://buildserver/" + url);
    httpget.setHeader("Accept", "application/json");

    HttpResponse response = client.execute(httpget);
    HttpEntity entity = response.getEntity();
    servletResponse.getWriter().write(EntityUtils.toString(entity));

}