Package org.apache.struts.chain.contexts

Examples of org.apache.struts.chain.contexts.ServletActionContext


            actionConfig.getSuffix(), saContext.getRequest());
    }

    protected void reset(ActionContext context, ActionConfig actionConfig,
        ActionForm actionForm) {
        ServletActionContext saContext = (ServletActionContext) context;

        actionForm.reset((ActionMapping) actionConfig, saContext.getRequest());

        // Set the multipart class
        if (actionConfig.getMultipartClass() != null) {
            saContext.getRequestScope().put(Globals.MULTIPART_KEY,
                actionConfig.getMultipartClass());
        }
    }
View Full Code Here


*          $
*/
public class SelectAction extends AbstractSelectAction {
    // ------------------------------------------------------- Protected Methods
    protected String getPath(ActionContext context) {
        ServletActionContext saContext = (ServletActionContext) context;
        HttpServletRequest request = saContext.getRequest();
        String path = null;
        boolean extension = false;

        // For prefix matching, match on the path info
        path = (String) request.getAttribute(Constants.INCLUDE_PATH_INFO);

        if ((path == null) || (path.length() == 0)) {
            path = request.getPathInfo();
        }

        // For extension matching, match on the servlet path
        if ((path == null) || (path.length() == 0)) {
            path =
                (String) request.getAttribute(Constants.INCLUDE_SERVLET_PATH);

            if ((path == null) || (path.length() == 0)) {
                path = request.getServletPath();
            }

            if ((path == null) || (path.length() == 0)) {
                throw new IllegalArgumentException(
                    "No path information in request");
            }

            extension = true;
        }

        // Strip the module prefix and extension (if any)
        ModuleConfig moduleConfig = saContext.getModuleConfig();
        String prefix = moduleConfig.getPrefix();

        if (!path.startsWith(prefix)) {
            throw new IllegalArgumentException("Path does not start with '"
                + prefix + "'");
View Full Code Here

*          $
*/
public class SetOriginalURI extends AbstractSetOriginalURI {
    // ------------------------------------------------------- Protected Methods
    protected void setOriginalURI(ActionContext context) {
        ServletActionContext swcontext = (ServletActionContext) context;
        HttpServletRequest request = swcontext.getRequest();

        request.setAttribute(Globals.ORIGINAL_URI_KEY, request.getServletPath());
    }
View Full Code Here

    protected ActionContext createActionContextInstance(
        ServletContext servletContext, HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException {
        if (this.actionContextClass == null) {
            return new ServletActionContext(servletContext, request, response);
        }

        try {
            if (this.servletActionContextConstructor == null) {
                return (ActionContext) this.actionContextClass.newInstance();
View Full Code Here

    public ActionForm createActionForm(ActionContext context)
        throws IllegalAccessException, InstantiationException {
        ActionServlet actionServlet = null;

        if (context instanceof ServletActionContext) {
            ServletActionContext saContext = (ServletActionContext) context;

            actionServlet = saContext.getActionServlet();
        }

        return createActionForm(actionServlet);
    }
View Full Code Here

        //  directly depends on ActionServlet
        if (actionCtx instanceof ServletActionContext) {
            // The servlet property of ActionForm is transient, so
            // ActionForms which are restored from a serialized state
            // need to have their servlet restored.
            ServletActionContext sac = (ServletActionContext) actionCtx;

            instance.setServlet(sac.getActionServlet());
        }

        actionCtx.setActionForm(instance);

        scope.put(actionConfig.getAttribute(), instance);
View Full Code Here

     * <p>Return the <code>Locale</code> to be used for this request.</p>
     *
     * @param context The <code>Context</code> for this request
     */
    protected Locale getLocale(ActionContext context) {
        ServletActionContext saContext = (ServletActionContext) context;

        // Has a Locale already been selected?
        HttpSession session = saContext.getRequest().getSession();
        Locale locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);

        if (locale != null) {
            return (locale);
        }

        // Select and cache the Locale to be used
        locale = saContext.getRequest().getLocale();

        if (locale == null) {
            locale = Locale.getDefault();
        }

View Full Code Here

*/
public class SelectModule extends AbstractSelectModule {
    // ------------------------------------------------------- Protected Methods
    protected String getPrefix(ActionContext context) {
        // Identify the URI from which we will match a module prefix
        ServletActionContext sacontext = (ServletActionContext) context;
        HttpServletRequest request = sacontext.getRequest();
        String uri =
            (String) request.getAttribute(Constants.INCLUDE_SERVLET_PATH);

        if (uri == null) {
            uri = request.getServletPath();
        }

        if (uri == null) {
            throw new IllegalArgumentException("No path information in request");
        }

        // Identify the module prefix for the current module
        String prefix = ""; // Initialize to default prefix
        String[] prefixes =
            (String[]) sacontext.getApplicationScope().get(Globals.MODULE_PREFIXES_KEY);
        int lastSlash = 0;

        while (prefix.equals("") && ((lastSlash = uri.lastIndexOf("/")) > 0)) {
            uri = uri.substring(0, lastSlash);

View Full Code Here

*          $
*/
public class RequestNoCache extends AbstractRequestNoCache {
    // ------------------------------------------------------- Protected Methods
    protected void requestNoCache(ActionContext context) {
        ServletActionContext sacontext = (ServletActionContext) context;
        HttpServletResponse response = sacontext.getResponse();

        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache,no-store,max-age=0");
        response.setDateHeader("Expires", 1);
    }
View Full Code Here

    protected ForwardConfig handle(ActionContext context, Exception exception,
        ExceptionConfig exceptionConfig, ActionConfig actionConfig,
        ModuleConfig moduleConfig)
        throws Exception {
        // Look up the remaining properties needed for this handler
        ServletActionContext sacontext = (ServletActionContext) context;
        ActionForm actionForm = (ActionForm) sacontext.getActionForm();
        HttpServletRequest request = sacontext.getRequest();
        HttpServletResponse response = sacontext.getResponse();

        // Handle this exception
        org.apache.struts.action.ExceptionHandler handler =
            (org.apache.struts.action.ExceptionHandler) ClassUtils
            .getApplicationInstance(exceptionConfig.getHandler());
View Full Code Here

TOP

Related Classes of org.apache.struts.chain.contexts.ServletActionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.