response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n <script src=\"/static/js/jquery.min.js\" type=\"text/javascript\"></script>\n <script src=\"/static/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n <script src=\"/static/js/tab.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\">\n $(document).ready(function() {\n $('li.active').removeClass('active');\n $('a[href=\"' + location.pathname + '\"]').closest('li').addClass('active');\n });\n </script>\n </body>\n</html>\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); _jspxFactory.releasePageContext(_jspx_page_context);
/** * Sets scope attribute. */ public static void setScopeAttribute(final String name, final Object value, final String scope, final PageContext pageContext) { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String scopeValue = scope != null ? scope.toLowerCase() : SCOPE_PAGE; if (scopeValue.equals(SCOPE_PAGE)) { pageContext.setAttribute(name, value); } else if (scopeValue.equals(SCOPE_REQUEST)) { request.setAttribute(name, value); } else if (scopeValue.equals(SCOPE_SESSION)) { request.getSession().setAttribute(name, value); } else if (scopeValue.equals(SCOPE_APPLICATION)) { request.getServletContext().setAttribute(name, value); } else { throw new IllegalArgumentException("Invalid scope: " + scope); } }
@Override public int doEndTag() throws JspException { EvaluationContext evaluationContext = (EvaluationContext) this.pageContext.getAttribute(EVALUATION_CONTEXT_PAGE_ATTRIBUTE); if (evaluationContext == null) { evaluationContext = createEvaluationContext(this.pageContext); this.pageContext.setAttribute(EVALUATION_CONTEXT_PAGE_ATTRIBUTE, evaluationContext); } if (this.var != null) { Object result = (this.expression != null ? this.expression.getValue(evaluationContext) : null); this.pageContext.setAttribute(this.var, result, this.scope); } else { try { String result = (this.expression != null ? this.expression.getValue(evaluationContext, String.class) : null); result = ObjectUtils.getDisplayString(result); result = htmlEscape(result); result = (this.javaScriptEscape ? JavaScriptUtils.javaScriptEscape(result) : result); this.pageContext.getOut().print(result); } catch (IOException ex) { throw new JspException(ex); } } return EVAL_PAGE; }
/** * Get the next unique ID (within the given {@link PageContext}) for the supplied name. */ public static String nextId(String name, PageContext pageContext) { String attributeName = PAGE_CONTEXT_ATTRIBUTE_PREFIX + name; Integer currentCount = (Integer) pageContext.getAttribute(attributeName); currentCount = (currentCount != null ? currentCount + 1 : 1); pageContext.setAttribute(attributeName, currentCount); return (name + currentCount); }
/** * Reset any previous nestedPath value. */ @Override public int doEndTag() { if (this.previousNestedPath != null) { // Expose previous nestedPath value. this.pageContext.setAttribute(NESTED_PATH_VARIABLE_NAME, this.previousNestedPath, PageContext.REQUEST_SCOPE); } else { // Remove exposed nestedPath value. this.pageContext.removeAttribute(NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE); } return EVAL_PAGE; }
/** * Create a new JspAwareRequestContext for the given page context, * using the given model attributes for Errors retrieval. * @param pageContext current JSP page context * @param model the model attributes for the current view * (can be {@code null}, using the request attributes for Errors retrieval) */ public JspAwareRequestContext(PageContext pageContext, @Nullable Map<String, Object> model) { super((HttpServletRequest) pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse(), pageContext.getServletContext(), model); this.pageContext = pageContext; }
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final java.lang.String _jspx_method = request.getMethod(); if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD"); return; response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write('\n'); out.write('\n'); out.write('\n'); if (response.isCommitted()) { if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); _jspxFactory.releasePageContext(_jspx_page_context);
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); String pageID = (String)request.getAttribute("pageID"); String subPageID = (String)request.getAttribute("subPageID"); JspWriter out = pageContext.getOut(); value = StringUtils.replace(value, "[id]", clean(tab.attributeValue("id"))); value = StringUtils.replace(value, "[url]", request.getContextPath() + "/" + clean(tab.attributeValue("url"))); value = StringUtils.replace(value, "[name]", clean(AdminConsole.getAdminText(tab.attributeValue("name"), pluginName))); out.write(buf.toString()); throw new JspException(ioe.getMessage());
@Override public void doTag() throws JspException { PageContext pageContext = (PageContext) getJspContext(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String scopeValue = scope != null ? scope.toLowerCase() : SCOPE_PAGE; if (scopeValue.equals(SCOPE_APPLICATION)) { request.getServletContext().removeAttribute(name); } else if (scopeValue.equals(SCOPE_SESSION)) { request.getSession().removeAttribute(name); } else if (scopeValue.equals(SCOPE_REQUEST)) { request.removeAttribute(name); } else if (scopeValue.equals(SCOPE_PAGE)) { pageContext.removeAttribute(name); } else { throw new JspException("Invalid scope: " + scope); } } }
/** * Stores context path in server context and request scope. */ public static void storeContextPath(final PageContext pageContext, final String contextPathVariableName) { String ctxPath = getContextPath(pageContext); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); request.setAttribute(contextPathVariableName, ctxPath); ServletContext servletContext = pageContext.getServletContext(); servletContext.setAttribute(contextPathVariableName, ctxPath); }
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest(); HttpServletResponse response = (HttpServletResponse) this.pageContext.getResponse(); url.append(request.getContextPath()); urlStr = response.encodeURL(urlStr);
@Override public void doTag() throws IOException { JspContext jspContext = this.getJspContext(); // generate token HttpServletRequest request = (HttpServletRequest) ((PageContext) jspContext).getRequest(); HttpSession session = request.getSession(); String value = CsrfShield.prepareCsrfToken(session); if (name == null) { name = CsrfShield.CSRF_TOKEN_NAME; } jspContext.getOut().write("<input type=\"hidden\" name=\"" + name + "\" value=\"" + value + "\"/>"); } }
public int doEndTag() throws JspException { if (bodyContent != null) { try { pageContext.getOut().print(bodyContent.getString()); } catch (IOException ioe) { throw new JspTagException(ioe.toString(), ioe); } } return EVAL_PAGE; }
public void init(PageContext pageContext){ this.request = (HttpServletRequest)pageContext.getRequest(); this.response = (HttpServletResponse)pageContext.getResponse(); this.session = pageContext.getSession(); this.application = pageContext.getServletContext(); this.out = pageContext.getOut(); } }
/** * * Creates the Map that maps cookie name to the first matching * Cookie in request.getCookies(). **/ public static Map createCookieMap (PageContext pContext) { // Read all the cookies and construct the entire map HttpServletRequest request = (HttpServletRequest) pContext.getRequest (); Cookie [] cookies = request.getCookies (); Map ret = new HashMap (); for (int i = 0; cookies != null && i < cookies.length; i++) { Cookie cookie = cookies [i]; if (cookie != null) { String name = cookie.getName (); if (!ret.containsKey (name)) { ret.put (name, cookie); } } } return ret; }
public static Object find(PageContext pageContext, String name) { Object object = pageContext.findAttribute(name); if (object != null) return object; return pageContext.getServletContext().getInitParameter(name); }
@Test public void bindTagWithFieldButWithoutErrorsInstance() throws JspException { PageContext pc = createPageContext(); BindTag tag = new BindTag(); tag.setPageContext(pc); tag.setPath("tb.name"); pc.getRequest().setAttribute("tb", new TestBean("juergen&eva", 99)); tag.doStartTag(); BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE); assertEquals("name", status.getExpression()); assertEquals("juergen&eva", status.getValue()); }
@Override public void doTag() throws IOException { PageContext pageContext = ((PageContext) getJspContext()); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String output = VtorUtil.resolveValidationMessage(request, violation); pageContext.getOut().write(output); }
@Override public int doEndTag() throws JspException { try { final ASN1InputStream decoder = new ASN1InputStream(value); ASN1Primitive primitive = decoder.readObject(); while (primitive != null && !(primitive instanceof ASN1Null)) { pageContext.getOut().write(doPrimitive(primitive)); primitive = decoder.readObject(); } } catch (Exception ex) { throw new JspException(ex.getMessage()); } return super.doEndTag(); }
@Override protected final int doStartTagInternal() throws Exception { String resolvedPath = getPath(); if (!isIgnoreNestedPath()) { String nestedPath = (String) this.pageContext.getAttribute( NestedPathTag.NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE); // only prepend if not already an absolute path if (nestedPath != null && !resolvedPath.startsWith(nestedPath) && !resolvedPath.equals(nestedPath.substring(0, nestedPath.length() - 1))) { resolvedPath = nestedPath + resolvedPath; } } try { this.status = new BindStatus(getRequestContext(), resolvedPath, isHtmlEscape()); } catch (IllegalStateException ex) { throw new JspTagException(ex.getMessage()); } // Save previous status values, for re-exposure at the end of this tag. this.previousPageStatus = this.pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE); this.previousRequestStatus = this.pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE); // Expose this tag's status object as PageContext attribute, // making it available for JSP EL. this.pageContext.removeAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE); this.pageContext.setAttribute(STATUS_VARIABLE_NAME, this.status, PageContext.REQUEST_SCOPE); return EVAL_BODY_INCLUDE; }