@Override protected HttpServletRequest getHttpServletRequest() { return ServletActionContext.getRequest(); } }
public String execute() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); String requestedUrl = request.getPathInfo(); if (successResultValue == null) successResultValue = requestedUrl; return SUCCESS; }
private static String getWebappContext() { // Calculate the webapp context. String webappContext = ServletActionContext.getRequest().getContextPath(); if ( StringUtils.isEmpty( webappContext ) ) { // Still empty? means you are a root context. webappContext = "/"; } return webappContext; }
protected void before(ActionInvocation invocation) throws Exception { _log.debug("Creating HttpSession"); ServletActionContext.getRequest().getSession(true); }
protected String getBaseUrl() { HttpServletRequest req = ServletActionContext.getRequest(); return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80 ? "" : ":" + req.getServerPort() ) + req.getContextPath(); } }
public ListEntityLinksContext getApplinksContext() { if (context == null) { final HttpServletRequest request = ServletActionContext.getRequest(); final String typeId = request.getParameter("typeId"); final String key = request.getParameter("key"); context = velocityContextFactory.buildListEntityLinksContext(request, typeId, key); } return context; } }
public String execute() throws Exception { // Init if (hasErrors()) return ERROR; // Begin if (ServletActionContext.getRequest() instanceof MultiPartRequestWrapper) { return handleUploadedFile((MultiPartRequestWrapper) ServletActionContext.getRequest()); } else { return ERROR; } }
/** * Returns true if the current view is the default display (ie not * printable, etc). * * @param ctx The current page context. * @return true if there is no special display in place. */ public boolean isDefaultDisplay( ConversionContext ctx ) { HttpServletRequest req = ServletActionContext.getRequest(); return req != null && StringUtils.isBlank( req.getParameter( DECORATOR_PARAM ) ) && RenderContextOutputType.DISPLAY.equals( ctx.getOutputType() ); }
private File generatePdfExportFromPdfExporterService(Object pdfExporterService) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Method exportMethod = pdfExporterService.getClass().getMethod("createPdfForPage", User.class, Page.class, String.class); return (File) exportMethod.invoke( pdfExporterService, AuthenticatedUserThreadLocal.get(), getPage(), ServletActionContext.getRequest().getContextPath() ); }
protected String processRequiresAuthentication( ActionInvocation invocation ) throws ComponentLookupException { HttpSession session = ServletActionContext.getRequest().getSession(); if ( session != null ) { session.removeAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); } addActionInvocation( invocation ).setBackTrack(); return REQUIRES_AUTHENTICATION; } }
private void removeCookiesAndSession() { autologinCookies.removeRememberMeCookie(); autologinCookies.removeSignonCookie(); HttpSession session = ServletActionContext.getRequest().getSession(); if ( session != null ) { session.removeAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); } }
/** * Returns true if the current view is printable - either the standard * 'print' view, Word or PDF. * * @param ctx The page context. * @return true if the printable view is being displayed. */ public boolean isPrintableDisplay( ConversionContext ctx ) { if ( RenderContextOutputType.PDF.equals( ctx.getOutputType() ) || RenderContextOutputType.WORD.equals( ctx.getOutputType() ) ) return true; HttpServletRequest req = ServletActionContext.getRequest(); return req != null && PRINTABLE_DECORATOR.equals( req.getParameter( DECORATOR_PARAM ) ); }
private User getRemoteUser() { HttpServletRequest request = ServletActionContext.getRequest(); if (request != null) { String remoteUserName = request.getRemoteUser(); if (remoteUserName != null) return userAccessor.getUser(remoteUserName); } return AuthenticatedUserThreadLocal.getUser(); }
private User getRemoteUser() { HttpServletRequest request = ServletActionContext.getRequest(); if (request != null) { String remoteUserName = request.getRemoteUser(); if (remoteUserName != null) return userAccessor.getUser(remoteUserName); } return AuthenticatedUserThreadLocal.getUser(); }
private String calculateBaseUrl() { // use request contextPath if it exists, otherwise (as in exports) use the configured base URL HttpServletRequest request = ServletActionContext.getRequest(); if (request != null) { return request.getContextPath(); } else { return settingsManager.getGlobalSettings().getBaseUrl(); } }
/** * Executes the regular servlet result. * * @param finalLocation * @param actionInvocation */ private void executeRegularServletResult(String finalLocation, ActionInvocation actionInvocation) throws ServletException, IOException { ServletContext ctx = ServletActionContext.getServletContext(); HttpServletRequest req = ServletActionContext.getRequest(); HttpServletResponse res = ServletActionContext.getResponse(); try { ctx.getRequestDispatcher(finalLocation).include(req, res); } catch (ServletException e) { LOG.error("ServletException including " + finalLocation, e); throw e; } catch (IOException e) { LOG.error("IOException while including result '" + finalLocation + "'", e); throw e; } }
/** * Returns true if the current action is the view option for the current * content. If we are not viewing any editable content, false is returned. * * @param ctx The page context. * @return true if the content is in 'view' mode. */ public boolean isViewAction( ConversionContext ctx ) { HttpServletRequest req = ServletActionContext.getRequest(); if ( req == null ) return false; Action action = getCurrentAction(); ContentEntityObject content = ctx.getEntity(); if ( content instanceof AbstractPage ) { // Page or BlogPost if ( action instanceof ViewPageAction ) return true; } return false; }
private SecuritySession getSecuritySession() { HttpSession session = ServletActionContext.getRequest().getSession(); if ( session == null ) { getLogger().debug( "No HTTP Session exists." ); return null; } SecuritySession secSession = (SecuritySession) session.getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); getLogger().debug( "Returning Security Session: " + secSession ); return secSession; } }
public AuthenticationKey getSignonKey() { Cookie ssoCookie = getCookie( ServletActionContext.getRequest(), SIGNON_KEY ); if ( ssoCookie == null ) { getLogger().debug( "Single Sign On Cookie Not Found: " + SIGNON_KEY ); return null; } // Found user with a single sign on key. String providedKey = ssoCookie.getValue(); getLogger().debug( "Found sso cookie : " + providedKey ); CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings(); return findAuthKey( SIGNON_KEY, providedKey, settings.getDomain(), settings.getPath() ); }
public AuthenticationKey getRememberMeKey() { if ( !isRememberMeEnabled() ) { return null; } Cookie rememberMeCookie = getCookie( ServletActionContext.getRequest(), REMEMBER_ME_KEY ); if ( rememberMeCookie == null ) { getLogger().debug( "Remember Me Cookie Not Found: " + REMEMBER_ME_KEY ); return null; } // Found user with a remember me key. String providedKey = rememberMeCookie.getValue(); getLogger().debug( "Found remember me cookie : " + providedKey ); CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings(); return findAuthKey( REMEMBER_ME_KEY, providedKey, settings.getDomain(), settings.getPath() ); }