List of usage examples for javax.servlet ServletRequest getAttribute
public Object getAttribute(String name);
Object
, or null
if no attribute of the given name exists. From source file:org.entando.entando.aps.tags.CheckWidgetOutputterTag.java
@Override public int doStartTag() throws JspException { ServletRequest req = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX); IPage page = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE); try {// ww w. ja v a2s. c o m String widgetOutput[] = (String[]) reqCtx.getExtraParam("ShowletOutput"); if (_frame < 0 || _frame >= widgetOutput.length) { _logger.error("Frame attribute {} exceeds the limit in the page {}", _frame, page.getCode()); return SKIP_BODY; } String output = widgetOutput[_frame]; if (StringUtils.isBlank(output)) { return SKIP_BODY; } else { return EVAL_BODY_INCLUDE; } } catch (Throwable t) { String msg = "Error detected checking the output widget"; _logger.error("Error detected checking the output widget", t); throw new JspException(msg, t); } }
From source file:org.apache.hadoop.hdfsproxy.AuthorizationFilter.java
protected String getUserId(ServletRequest request) { return (String) request.getAttribute("org.apache.hadoop.hdfsproxy.authorized.userID"); }
From source file:org.sonatype.nexus.security.filter.authz.FailureLoggingHttpMethodPermissionFilter.java
protected Nexus getNexus(ServletRequest request) { Nexus nexus = (Nexus) request.getAttribute(Nexus.class.getName()); if (nexus == null) { nexus = NexusBooterListener.getNexus(); }//w w w . jav a 2s. co m return nexus; }
From source file:org.apache.hadoop.hdfsproxy.AuthorizationFilter.java
protected List<Path> getAllowedPaths(ServletRequest request) { return (List<Path>) request.getAttribute("org.apache.hadoop.hdfsproxy.authorized.paths"); }
From source file:shiver.me.timbers.spring.security.CookieAndHeaderJwtAuthenticationFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request.getAttribute(FILTER_APPLIED) != null) { chain.doFilter(request, response); return;/*ww w. j ava 2 s . c o m*/ } try { final Authentication authentication = tokenParser.parse((HttpServletRequest) request); securityContextHolder.getContext().setAuthentication(authentication); authenticationApplier.apply(authentication, (HttpServletResponse) response); request.setAttribute(FILTER_APPLIED, TRUE); } catch (JwtInvalidTokenException e) { log.debug("Failed JWT authentication.", e); } chain.doFilter(request, response); }
From source file:org.entando.entando.plugins.jacms.aps.tags.RowContentListTag.java
@Override public int doEndTag() throws JspException { ServletRequest request = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX); try {/* w w w . j ava 2s .c o m*/ this.extractExtraWidgetParameters(reqCtx); List<Properties> contents = this.getContents(reqCtx); this.pageContext.setAttribute(this.getListName(), contents); } catch (Throwable t) { _logger.error("error in end tag", t); throw new JspException("Error detected while finalising the tag", t); } this.release(); return EVAL_PAGE; }
From source file:org.apache.nifi.minifi.c2.security.authentication.X509AuthenticationFilter.java
private void authenticateIfPossible(ServletRequest request) { if (!request.isSecure()) { return;/* ww w .ja va2s . c om*/ } X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); if (certs == null || certs.length == 0) { if (logger.isDebugEnabled()) { logger.debug( "Unable to get certificates in request from " + HttpRequestUtil.getClientString(request)); } return; } Authentication authentication = authenticationManager.authenticate(new X509AuthenticationToken(certs)); if (authentication.isAuthenticated()) { SecurityContextHolder.getContext().setAuthentication(authentication); } }
From source file:com.ace.erp.filter.user.SysUserFilter.java
protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException { User user = (User) request.getAttribute(Constants.CURRENT_USER); String url = null;//from w w w .j a v a 2 s .co m if (Boolean.TRUE.equals(user.getDeleted())) { url = getUserNotfoundUrl(); } else if (user.getStatus() == UserStatus.blocked) { url = getUserBlockedUrl(); } else { url = getUserUnknownErrorUrl(); } WebUtils.issueRedirect(request, response, url); }
From source file:com.agiletec.plugins.jpblog.aps.tags.BlogArchiveTag.java
@Override public int doEndTag() throws JspException { ServletRequest request = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX); try {/*www .j ava 2s . c o m*/ IBlogArchiveTagHelper helper = (IBlogArchiveTagHelper) ApsWebApplicationUtils .getBean(JpblogSystemConstants.BLOG_ARCHIVE_TAG_HELPER, this.pageContext); List<BlogArchiveInfoBean> list = helper.getBlogArchiveList(this, reqCtx); this.pageContext.setAttribute(this.getVar(), list); } catch (Throwable t) { _logger.error("error in doEndTag", t); throw new JspException("Error detected while finalising the tag", t); } this.release(); return EVAL_PAGE; }
From source file:org.romaframework.aspect.view.html.transformer.jsp.JspTemplateManager.java
public void execute(String templateName, HtmlViewRenderable renderable, String part, Writer writer) { ServletRequest request = HtmlViewAspectHelper.getServletRequest(); final String classJsp = getTemplatesPath() + templateName; final Object previousComponent = request.getAttribute(RequestConstants.CURRENT_COMPONENT_IN_TRANSFORMER); request.setAttribute(RequestConstants.CURRENT_COMPONENT_IN_TRANSFORMER, renderable); final Object previousPart = request.getAttribute(RequestConstants.CURRENT_COMPONENT_PART_IN_TRANSFORMER); request.setAttribute(RequestConstants.CURRENT_COMPONENT_PART_IN_TRANSFORMER, part); try {// www .ja va2s. c o m HtmlViewAspectHelper.getHtmlFromJSP(request, classJsp, writer); } catch (ServletException e) { log.error("error in jsp transformer", e.getRootCause() == null ? e : e.getRootCause()); } catch (IOException e) { log.error("maybe wrong render defined", e); } request.setAttribute(RequestConstants.CURRENT_COMPONENT_IN_TRANSFORMER, previousComponent); request.setAttribute(RequestConstants.CURRENT_COMPONENT_PART_IN_TRANSFORMER, previousPart); }