List of usage examples for javax.servlet ServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:org.surfnet.oaaas.auth.AbstractUserConsentHandler.java
/** * Set the granted scopes of the consent on the request. Note: this optional. * /*from ww w .j a v a 2 s.c om*/ * @param request * the original ServletRequest * @param scopes * the {@link String[]} scopes. */ protected final void setGrantedScopes(ServletRequest request, String[] scopes) { request.setAttribute(GRANTED_SCOPES, scopes); }
From source file:CheckFilter.java
private void reject(ServletRequest request, ServletResponse response) throws IOException, ServletException { request.setAttribute("errorMsg", "Please make sure to provide a valid value for all of the text fields."); Enumeration params = request.getParameterNames(); String paramN = null;/*from www . ja v a 2s . c o m*/ while (params.hasMoreElements()) { paramN = (String) params.nextElement(); request.setAttribute(paramN, request.getParameter(paramN)); } RequestDispatcher dispatcher = request.getRequestDispatcher("/form.jsp"); dispatcher.forward(request, response); }
From source file:com.mtgi.analytics.servlet.BehaviorTrackingListener.java
public void requestInitialized(ServletRequestEvent event) { checkInit(event);//from w w w . j av a 2 s . c o m if (adapters != null) { BehaviorEvent[] events = new BehaviorEvent[adapters.length]; ServletRequest request = event.getServletRequest(); request.setAttribute(ATT_EVENTS, events); for (int i = 0; i < adapters.length; ++i) try { events[i] = adapters[i].start(request); } catch (Exception e) { log.error("Error starting http event", e); } } }
From source file:edu.cornell.mannlib.vitro.webapp.filters.TestFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { log.debug("in TestFilter.doFilter()"); request.setAttribute("TestAttr", "This is a test value, it could be a setup VitroFacade"); chain.doFilter(request, response);//from www .j a va 2s.c om }
From source file:com.krawler.common.listeners.LocaleResolverListener.java
@Override public void requestInitialized(ServletRequestEvent sre) { ServletRequest request = sre.getServletRequest(); ServletContext context = sre.getServletContext(); if (request != null && context != null) { request.setAttribute(LocaleUtils.LOCALE_RESOLVER_ATTRIBUTE, context.getAttribute(LocaleUtils.LOCALE_RESOLVER_NAME)); } else {//from w w w.j a va 2 s .co m log.debug("Locale resolver cannot be associated with request [request:" + request + ",context:" + context + "]"); } }
From source file:org.eclipse.skalli.view.internal.filter.ConfigFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setAttribute(Consts.ATTRIBUTE_PAGETITLE, Consts.DEFAULT_PAGETITLE); request.setAttribute(Consts.ATTRIBUTE_SEARCH_PLUGIN_TITLE, Consts.DEFAULT_PAGETITLE); request.setAttribute(Consts.ATTRIBUTE_SEARCH_PLUGIN_DESCRIPTION, Consts.DEFAULT_SEARCH_PLUGIN_DESCRIPTION); ConfigurationService confService = Services.getService(ConfigurationService.class); if (confService != null) { FeedbackConfig feedbackConfig = confService.readConfiguration(FeedbackConfig.class); if (feedbackConfig != null) { request.setAttribute(Consts.ATTRIBUTE_FEEDBACKCONFIG, feedbackConfig); }/* w ww. jav a 2s .c om*/ TopLinksConfig toplinksConfig = confService.readConfiguration(TopLinksConfig.class); if (toplinksConfig != null) { request.setAttribute(Consts.ATTRIBUTE_TOPLINKSCONFIG, toplinksConfig); } NewsConfig newsConfig = confService.readConfiguration(NewsConfig.class); if (newsConfig != null) { request.setAttribute(Consts.ATTRIBUTE_NEWSCONFIG, newsConfig); } BrandingConfig brandingConfig = confService.readConfiguration(BrandingConfig.class); if (brandingConfig != null) { request.setAttribute(Consts.ATTRIBUTE_BRANDINGCONFIG, brandingConfig); if (StringUtils.isNotBlank(brandingConfig.getPageTitle())) { request.setAttribute(Consts.ATTRIBUTE_PAGETITLE, brandingConfig.getPageTitle()); } if (StringUtils.isNotBlank(brandingConfig.getSearchPluginTitle())) { request.setAttribute(Consts.ATTRIBUTE_SEARCH_PLUGIN_TITLE, brandingConfig.getSearchPluginTitle()); } if (StringUtils.isNotBlank(brandingConfig.getSearchPluginDescription())) { request.setAttribute(Consts.ATTRIBUTE_SEARCH_PLUGIN_DESCRIPTION, brandingConfig.getSearchPluginDescription()); } } UserDetailsConfig userDetailsConfig = confService.readConfiguration(UserDetailsConfig.class); if (userDetailsConfig != null) { request.setAttribute(Consts.ATTRIBUTE_USERDETAILSCONFIG, userDetailsConfig); } } // proceed along the chain chain.doFilter(request, response); }
From source file:com.jaspersoft.jasperserver.war.tags.ParametersFormTag.java
protected void setAttributes() { ServletRequest request = pageContext.getRequest(); if (onInputChange != null && onInputChange.length() > 0) { request.setAttribute(ATTRIBUTE_ON_INPUT_CHANGE, onInputChange); }// www . j a v a 2 s. c om request.setAttribute(ATTRIBUTE_INPUT_NAME_PREFIX, getInputNamePrefix()); request.setAttribute(ATTRIBUTE_READ_ONLY, Boolean.valueOf(isReadOnly())); }
From source file:org.wso2.carbon.identity.relyingparty.saml.SAMLTokenConsumer.java
/** * When the data token is invalid, this method injects invalid status message. * //from ww w .j a v a2s .c o m * @param verifier * @param request */ protected void injectDataToRequestOnFailure(SAMLTokenVerifier verifier, ServletRequest request) { request.setAttribute(TokenVerifierConstants.SERVLET_ATTR_STATE, TokenVerifierConstants.STATE_FAILURE); }
From source file:org.sonatype.nexus.security.filter.authz.FailureLoggingHttpMethodPermissionFilter.java
@Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException { recordAuthzFailureEvent(request, response); request.setAttribute(NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED, Boolean.TRUE); return false; }
From source file:org.alfresco.web.awe.filter.WebEditorFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // set up spring web editor tag library objects request.setAttribute(TemplateConstants.REQUEST_ATTR_KEY_WEF_ENABLED, Boolean.TRUE); request.setAttribute(TemplateConstants.REQUEST_ATTR_KEY_URL_PREFIX, this.urlPrefix); request.setAttribute(TemplateConstants.REQUEST_ATTR_KEY_DEBUG_ENABLED, this.debugEnabled); if (logger.isDebugEnabled()) { logger.debug("Setup request for Web Editor: (urlPrefix: " + this.urlPrefix + ", debug: " + this.debugEnabled + ")"); }/*from w ww .j a va2 s . c om*/ chain.doFilter(request, response); }