Tabnine Logo
ServletActionContext
Code IndexAdd Tabnine to your IDE (free)

How to use
ServletActionContext
in
com.opensymphony.webwork

Best Java code snippets using com.opensymphony.webwork.ServletActionContext (Showing top 20 results out of 315)

origin: org.randombits.support/support-confluence

  @Override
  protected HttpServletRequest getHttpServletRequest() {
    return ServletActionContext.getRequest();
  }
}
origin: com.opensymphony/webwork

/**
 * 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;
  }
}
origin: com.opensymphony/webwork

/**
 * Build the instance of the ScopesHashModel, including JspTagLib support
 * <p/>Objects added to the model are <p/>
 * <ul>
 * <li>Application - servlet context attributes hash model
 * <li>JspTaglibs - jsp tag lib factory model
 * <li>Request - request attributes hash model
 * <li>Session - session attributes hash model
 * <li>req - the HttpServletRequst object for direct access
 * <li>res - the HttpServletResponse object for direct access
 * <li>stack - the OgnLValueStack instance for direct access
 * <li>ognl - the instance of the OgnlTool
 * <li>action - the action itself
 * <li>exception - optional : the JSP or Servlet exception as per the
 * servlet spec (for JSP Exception pages)
 * <li>webwork - instance of the WebWorkUtil class
 * </ul>
 */
protected TemplateModel createModel() throws TemplateModelException {
  ServletContext servletContext = ServletActionContext
      .getServletContext();
  HttpServletRequest request = ServletActionContext.getRequest();
  HttpServletResponse response = ServletActionContext.getResponse();
  OgnlValueStack stack = ServletActionContext.getContext()
      .getValueStack();
  return FreemarkerManager.getInstance().buildTemplateModel(stack,
      invocation.getAction(), servletContext, request, response,
      wrapper);
}
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

private boolean authenticateWithSeraphAuthenticator(String userName, String password) throws AuthenticatorException {
  SecurityConfig securityConfig = SeraphUtils.getConfig(ServletActionContext.getRequest());
  if (null != securityConfig) {
    Authenticator authenticator = securityConfig.getAuthenticator();
    boolean authenticated = authenticator.login(
        ServletActionContext.getRequest(),
        ServletActionContext.getResponse(),
        userName,
        password
    );
    log.debug(new StringBuilder("Authenticating as ")
        .append(userName)
        .append(" with md5hex password ").append(DigestUtils.md5Hex(StringUtils.defaultString(password)))
        .append(" by ").append(authenticator.getClass().getName())
        .append(" results in ").append(authenticated).toString());
    return authenticated;
  }
  log.error("Unable to get an Authenticator from Seraph.");
  return false;
}
origin: com.opensymphony/webwork

protected Templates getTemplates(String path) throws TransformerException, IOException {
  String pathFromRequest = ServletActionContext.getRequest().getParameter("xslt.location");
  if (pathFromRequest != null)
    path = pathFromRequest;
  if (path == null)
    throw new TransformerException("Stylesheet path is null");
  Templates templates = (Templates) templatesCache.get(path);
  if (noCache || (templates == null)) {
    synchronized (templatesCache) {
      URL resource = ServletActionContext.getServletContext().getResource(path);
      if (resource == null) {
        throw new TransformerException("Stylesheet " + path + " not found in resources.");
      }
      log.debug("Preparing XSLT stylesheet templates: " + path);
      TransformerFactory factory = TransformerFactory.newInstance();
      templates = factory.newTemplates(new StreamSource(resource.openStream()));
      templatesCache.put(path, templates);
    }
  }
  return templates;
}
origin: org.randombits.support/support-confluence

@Override
protected HttpServletResponse getHttpServletResponse() {
  return ServletActionContext.getResponse();
}
origin: com.opensymphony/webwork

PageContext pageContext = ServletActionContext.getPageContext();
  HttpServletRequest request = ServletActionContext.getRequest();
  HttpServletResponse response = ServletActionContext.getResponse();
  RequestDispatcher dispatcher = request.getRequestDispatcher(finalLocation);
origin: org.codehaus.redback/redback-xwork-integration

Map session = ServletActionContext.getContext().getSession();
HttpServletRequest request = ServletActionContext.getRequest();
  expirationDate.setTime( user.getLastPasswordChange() );
  expirationDate.add( Calendar.DAY_OF_MONTH, policy.getPasswordExpirationDays() );
  Map session = ServletActionContext.getContext().getSession();
  session.put( "passwordExpirationNotification", expirationDate.getTime().toString() );
origin: com.atlassian.confluence.extra/confluence-flyingpdf-plugin

public ServletContext getServletContext() {
  if (servletContext != null)
    return servletContext;
  else
    return ServletActionContext.getServletContext();
}
origin: com.opensymphony/webwork

private static String translateVariable(String input) {
  OgnlValueStack valueStack = ServletActionContext.getContext().getValueStack();
  String output = TextParseUtil.translateVariables(input, valueStack);
  return output;
}
origin: com.opensymphony/webwork

/**
 *  Applies the decorator, creating the relevent contexts and delegating to
 *  the extended applyDecorator().
 * 
 * @param page The page
 * @param decorator The decorator
 * @param req The servlet request
 * @param res The servlet response
 */
protected void applyDecorator(Page page, Decorator decorator,
               HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    
  ServletContext servletContext = filterConfig.getServletContext();
  ActionContext ctx = ServletActionContext.getActionContext(req);
  if (ctx == null) {
    // ok, one isn't associated with the request, so let's get a ThreadLocal one (which will create one if needed)
    OgnlValueStack vs = new OgnlValueStack();
    vs.getContext().putAll(DispatcherUtils.getInstance().createContextMap(req, res, null, servletContext));
    ctx = new ActionContext(vs.getContext());
    if (ctx.getActionInvocation() == null) {
      // put in a dummy ActionSupport so basic functionality still works
      ActionSupport action = new ActionSupport();
      vs.push(action);
      ctx.setActionInvocation(new DummyActionInvocation(action));
    }
  }
  // delegate to the actual page decorator
  applyDecorator(page, decorator, req, res, servletContext, ctx);
}
origin: com.opensymphony/webwork

/**
 * The default writer writes directly to the response writer.
 */
protected Writer getWriter() throws IOException {
  return ServletActionContext.getResponse().getWriter();
}
origin: com.opensymphony/webwork

this.wrapper = getObjectWrapper();
HttpServletRequest req = ServletActionContext.getRequest();
HttpServletResponse res = ServletActionContext.getResponse();
origin: com.opensymphony/webwork

/**
 * Get the URI Resolver to be called by the processor when it encounters an xsl:include, xsl:import, or document()
 * function. The default is an instance of ServletURIResolver, which operates relative to the servlet context.
 */
protected URIResolver getURIResolver() {
  return new ServletURIResolver(
      ServletActionContext.getServletContext());
}
origin: com.opensymphony/webwork

protected TemplateModel createModel(ObjectWrapper wrapper, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws TemplateModelException {
  OgnlValueStack stack = ServletActionContext.getContext().getValueStack();
  Object action = null;
  if (ServletActionContext.getContext().getActionInvocation() != null) {
    action = ServletActionContext.getContext().getActionInvocation().getAction();
  }
  TemplateModel model = FreemarkerManager.getInstance().buildTemplateModel(stack, action, servletContext, request, response, wrapper);
  return model;
}
origin: com.opensymphony/webwork

public String execute() throws Exception {
  HttpServletRequest request = ServletActionContext.getRequest();
  String requestedUrl = request.getPathInfo();
  if (successResultValue == null) successResultValue = requestedUrl;
  return SUCCESS;
}
origin: com.opensymphony/webwork

this.invocation = invocation;
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
ServletContext servletContext = ServletActionContext.getServletContext();
origin: com.opensymphony/webwork

/**
 * Prints the current context to the response in XML format.
 */
protected void printContext() {
  HttpServletResponse res = ServletActionContext.getResponse();
  res.setContentType("text/xml");
  try {
    PrettyPrintWriter writer = new PrettyPrintWriter(
        ServletActionContext.getResponse().getWriter());
    printContext(writer);
    writer.close();
  } catch (IOException ex) {
    ex.printStackTrace();
  }
}
origin: com.opensymphony/webwork

/**
 * Build the instance of the ScopesHashModel, including JspTagLib support
 * <p/>
 * Objects added to the model are
 * <p/>
 * <ul>
 * <li>Application - servlet context attributes hash model
 * <li>JspTaglibs - jsp tag lib factory model
 * <li>Request - request attributes hash model
 * <li>Session - session attributes hash model
 * <li>req - the HttpServletRequst object for direct access
 * <li>res - the HttpServletResponse object for direct access
 * <li>stack - the OgnLValueStack instance for direct access
 * <li>ognl - the instance of the OgnlTool
 * <li>action - the action itself
 * <li>exception - optional : the JSP or Servlet exception as per the servlet spec (for JSP Exception pages)
 * <li>webwork - instance of the WebWorkUtil class
 * </ul>
 */
protected TemplateModel createModel() throws TemplateModelException {
  ServletContext servletContext = ServletActionContext.getServletContext();
  HttpServletRequest request = ServletActionContext.getRequest();
  HttpServletResponse response = ServletActionContext.getResponse();
  OgnlValueStack stack = ServletActionContext.getContext().getValueStack();
  Object action = null;
  if(invocation!= null ) action = invocation.getAction(); //Added for NullPointException
  return FreemarkerManager.getInstance().buildTemplateModel(stack, action, servletContext, request, response, wrapper);
}
origin: com.opensymphony/webwork

/**
 * Execute the given Tiles controller.
 *
 * @param controller the component controller to execute
 * @param context    the component context
 * @param request    current HTTP request
 * @param response   current HTTP response
 * @throws Exception if controller execution failed
 */
protected void executeController(
    Controller controller, ComponentContext context, HttpServletRequest request, HttpServletResponse response)
    throws Exception {
  controller.execute(context, request, response, ServletActionContext.getServletContext());
}
com.opensymphony.webworkServletActionContext

Javadoc

Web-specific context information for actions. This class subclasses ActionContext which provides access to things like the action name, value stack, etc. This class adds access to web objects like servlet parameters, request attributes and things like the HTTP session.

Most used methods

  • getRequest
    Gets the HTTP servlet request object.
  • getResponse
    Gets the HTTP servlet response object.
  • getContext
  • getServletContext
    Gets the servlet context.
  • getActionContext
  • getPageContext
    Returns the HTTP page context.
  • getServletConfig
  • getValueStack
  • setRequest
    Sets the HTTP servlet request object.
  • setResponse
    Sets the HTTP servlet response object.

Popular in Java

  • Updating database using SQL prepared statement
  • getApplicationContext (Context)
  • putExtra (Intent)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Join (org.hibernate.mapping)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now