/** * Public constructor with JSP variables.<p> * * @param context the JSP page context * @param req the JSP request * @param res the JSP response */ public CmsAjaxImageGallery(PageContext context, HttpServletRequest req, HttpServletResponse res) { this(new CmsJspActionElement(context, req, res)); }
/** * Redirects the response to the target link using a "301 - Moved Permanently" header.<p> * * This implementation will work only on JSP pages in OpenCms that use the default JSP loader implementation.<p> * * @param jsp the OpenCms JSP context * @param target the target link */ public static void redirectPermanently(CmsJspActionElement jsp, String target) { String newTarget = OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true); jsp.getRequest().setAttribute( CmsRequestUtil.ATTRIBUTE_ERRORCODE, new Integer(HttpServletResponse.SC_MOVED_PERMANENTLY)); jsp.getResponse().setHeader(HEADER_LOCATION, newTarget); jsp.getResponse().setHeader(HEADER_CONNECTION, "close"); }
/** * Include a sub-element without parameters from the OpenCms VFS, same as * using the <code><cms:include file="***" /></code> tag.<p> * * @param target the target URI of the file in the OpenCms VFS (can be relative or absolute) * @throws JspException in case there were problems including the target * * @see org.opencms.jsp.CmsJspTagInclude */ public void include(String target) throws JspException { include(target, null, null); }
/** * Returns an initialized {@link CmsJspNavBuilder} instance.<p> * * @return an initialized navigation builder instance * * @see org.opencms.jsp.CmsJspNavBuilder */ public CmsJspNavBuilder getNavigation() { if (isNotInitialized()) { return null; } if (m_vfsNav == null) { m_vfsNav = new CmsJspNavBuilder(getCmsObject()); } return m_vfsNav; }
/** * Initializes this workplace class instance.<p> * * This method can be used in case there a workplace class was generated using * {@link Class#forName(java.lang.String)} to initialize the class members.<p> * * @param jsp the initialized JSP context */ protected void initWorkplaceMembers(CmsJspActionElement jsp) { if (jsp != null) { m_jsp = jsp; initWorkplaceMembers(m_jsp.getCmsObject(), m_jsp.getRequest().getSession()); } }
/** * Sets the ouUsers.<p> * * @param ouUsers the ouUsers to set */ public void setOuUsers(List<CmsUser> ouUsers) { m_ouUsers = ouUsers; getJsp().getRequest().getSession().setAttribute(A_CmsOrgUnitUsersList.ORGUNIT_USERS, m_ouUsers); }
/** * Performs the user agreement declined action, will be called by the JSP page.<p> * * @throws IOException if problems while redirecting occur */ public void actionDecline() throws IOException { getJsp().getRequest().getSession().invalidate(); getJsp().getResponse().sendRedirect(getJsp().link(getParamWpres())); }
/** * Displays the throwable on the error page and logs the error.<p> * * @param wp the workplace class * @param t the throwable to be displayed on the error page * * @throws JspException if the include of the error page jsp fails */ public void includeErrorpage(CmsWorkplace wp, Throwable t) throws JspException { CmsLog.getLog(wp).error(Messages.get().getBundle().key(Messages.ERR_WORKPLACE_DIALOG_0), t); getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, wp); getJsp().getRequest().setAttribute(ATTRIBUTE_THROWABLE, t); getJsp().include(FILE_DIALOG_SCREEN_ERRORPAGE); }
/** * Sets the value of a specific cookie.<p> * If no cookie exists with the value, a new cookie will be created. * * @param jsp the CmsJspActionElement to use * @param name the name of the cookie * @param value the value of the cookie */ public static void setCookieValue(CmsJspActionElement jsp, String name, String value) { Cookie[] cookies = jsp.getRequest().getCookies(); for (int i = 0; (cookies != null) && (i < cookies.length); i++) { if (name.equalsIgnoreCase(cookies[i].getName())) { cookies[i].setValue(value); return; } } Cookie cookie = new Cookie(name, value); jsp.getResponse().addCookie(cookie); }
/** * Constructor with the action element to use. <p> * * @param action the action element to use */ public CmsHelpSearchResultView(CmsJspActionElement action) { m_jsp = action; m_formCache = new TreeMap<String, String>(); try { m_onlineProject = m_jsp.getCmsObject().readProject(CmsProject.ONLINE_PROJECT_ID); m_offlineProject = m_jsp.getRequestContext().getCurrentProject(); } catch (CmsException e) { // failed to get online project, at least avoid NPE m_onlineProject = m_offlineProject; } }
/** * @see org.opencms.workplace.editors.I_CmsEditorActionHandler#getButtonUrl(CmsJspActionElement, java.lang.String) */ public String getButtonUrl(CmsJspActionElement jsp, String resourceName) { // get the button image String button = CmsWorkplace.VFS_PATH_RESOURCES + "buttons/publish.png"; if (!isButtonActive(jsp, resourceName)) { // show disabled button if not active button = CmsWorkplace.VFS_PATH_RESOURCES + "buttons/publish_in.png"; } return jsp.link(button); }
/** * Returns the http URI of the current dialog, to be used * as value for the "action" attribute of a html form.<p> * * This URI is the real one.<p> * * @return the http URI of the current dialog */ public String getDialogRealUri() { return getJsp().link(getJsp().getRequestContext().getUri()); }
/** * Returns the link URL to get back one folder in the administration view.<p> * * @return the link URL to get back one folder in the administration view */ protected String getAdministrationBackLink() { return CmsWorkplace.VFS_PATH_WORKPLACE + "action/administration_content_top.html" + "?sender=" + CmsResource.getParentFolder(getJsp().getRequestContext().getFolderUri()); }
/** * Validates the needed parameters and display the frameset.<p> * * @throws IOException in case of errros displaying to the required page */ public void displayFrameSet() throws IOException { if (getJsp().getRequest().getParameter(CmsListExplorerFrameset.PARAM_PAGE) != null) { int page = Integer.parseInt(getJsp().getRequest().getParameter(CmsListExplorerFrameset.PARAM_PAGE)); getSettings().setExplorerPage(page); if (getSettings().getCollector() instanceof I_CmsListResourceCollector) { I_CmsListResourceCollector collector = (I_CmsListResourceCollector)getSettings().getCollector(); collector.setPage(page); } } JspWriter out = getJsp().getJspContext().getOut(); out.print(defaultActionHtml()); }
/** * Returns the OpenCms user context to use.<p> * * @return the OpenCms user context to use */ protected CmsObject getCmsObject() { return m_jspActionElement.getCmsObject(); }
/** * Insert the end HTML for the direct edit buttons in manual mode (if required).<p> * * Same as closing the <code></cms:editable</code> tag after opening one in manual mode.<p> * * @param needsClose result of {@link #editableManualOpen()} should be the value for this parameter * * @throws JspException if something goes wrong */ public void editableManualClose(boolean needsClose) throws JspException { if (needsClose) { CmsJspTagEditable.editableTagAction(getJspContext(), null, CmsDirectEditMode.MANUAL, null); } }
/** * Redirects the response to the target link.<p> * * Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} * to avoid relative links with secure sites (and issues with apache).<p> * * @param jsp the OpenCms JSP context * @param target the target link * * @throws IOException if something goes wrong during redirection */ public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
/** * Performs the the user agreement accept action, will be called by the JSP page.<p> * * @throws IOException if problems while redirecting occur */ public void actionAccept() throws IOException { acceptAgreement(); // redirect to the originally requested resource getJsp().getResponse().sendRedirect(getJsp().link(getParamWpres())); }
/** * Returns true if the currently processed element is an included sub element.<p> * * @return true if the currently processed element is an included sub element */ public boolean isSubElement() { return !getJsp().getRequestContext().getUri().equals(getJsp().info("opencms.request.element.uri")); }
/** * Sends a http redirect to the specified URI in the OpenCms VFS.<p> * * @param location the location the response is redirected to * @throws IOException in case redirection fails */ public void sendCmsRedirect(String location) throws IOException { // TOOD: IBM Websphere v5 has problems here, use forward instead (which has other problems) getJsp().getResponse().sendRedirect(OpenCms.getSystemInfo().getOpenCmsContext() + location); }