Package org.apache.struts.chain.contexts

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


    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


     * @throws Exception if thrown by the <code>Action</code>
     */
    protected ForwardConfig execute(ActionContext context, Action action,
        ActionConfig actionConfig, ActionForm actionForm)
        throws Exception {
        ServletActionContext saContext = (ServletActionContext) context;

        return (action.execute((ActionMapping) actionConfig, actionForm,
            saContext.getRequest(), saContext.getResponse()));
    }
View Full Code Here

     * @param context    The context for this request
     * @param actionForm The form bean for this request
     */
    protected ActionErrors validate(ActionContext context,
        ActionConfig actionConfig, ActionForm actionForm) {
        ServletActionContext saContext = (ServletActionContext) context;
        ActionErrors errors =
            (actionForm.validate((ActionMapping) actionConfig,
                saContext.getRequest()));

        // Special handling for multipart request
        if ((errors != null) && !errors.isEmpty()) {
            if (actionForm.getMultipartRequestHandler() != null) {
                if (log.isTraceEnabled()) {
View Full Code Here

     * @param context The context for this request
     * @param uri     The uri to be included
     */
    protected void perform(ActionContext context, String uri)
        throws Exception {
        ServletActionContext swcontext = (ServletActionContext) context;

        HttpServletRequest request = swcontext.getRequest();

        RequestDispatcher rd = swcontext.getContext().getRequestDispatcher(uri);

        rd.forward(request, swcontext.getResponse());
    }
View Full Code Here

    // ------------------------------------------------------- Protected Methods
    protected boolean isAuthorized(ActionContext context, String[] roles,
        ActionConfig mapping)
        throws Exception {
        // Identify the HTTP request object
        ServletActionContext servletActionContext =
            (ServletActionContext) context;
        HttpServletRequest request = servletActionContext.getRequest();

        // Check the current user against the list of required roles
        for (int i = 0; i < roles.length; i++) {
            if (request.isUserInRole(roles[i])) {
                return (true);
View Full Code Here

        return (false);
    }

    protected String getErrorMessage(ActionContext context,
        ActionConfig actionConfig) {
        ServletActionContext servletActionContext =
            (ServletActionContext) context;

        // Retrieve internal message resources
        ActionServlet servlet = servletActionContext.getActionServlet();
        MessageResources resources = servlet.getInternal();

        return resources.getMessage("notAuthorized", actionConfig.getPath());
    }
View Full Code Here

     * @param context       The context for this request
     * @param forwardConfig The forward to be performed
     */
    protected void perform(ActionContext context, ForwardConfig forwardConfig)
        throws Exception {
        ServletActionContext sacontext = (ServletActionContext) context;
        String uri = forwardConfig.getPath();

        if (uri == null) {
            ActionServlet servlet = sacontext.getActionServlet();
            MessageResources resources = servlet.getInternal();

            throw new IllegalArgumentException(resources.getMessage("forwardPathNull"));
        }

        HttpServletRequest request = sacontext.getRequest();
        ServletContext servletContext = sacontext.getContext();
        HttpServletResponse response = sacontext.getResponse();

        if (uri.startsWith("/")) {
            uri = resolveModuleRelativePath(forwardConfig, servletContext, request);
        }

View Full Code Here

                actions.put(type, action);
            }
        }

        if (action.getServlet() == null) {
            ServletActionContext saContext = (ServletActionContext) context;
            ActionServlet actionServlet = saContext.getActionServlet();

            action.setServlet(actionServlet);
        }

        return (action);
View Full Code Here

*          $
*/
public class SetContentType extends AbstractSetContentType {
    // ------------------------------------------------------- Protected Methods
    protected void setContentType(ActionContext context, String contentType) {
        ServletActionContext swcontext = (ServletActionContext) context;
        HttpServletResponse response = swcontext.getResponse();

        response.setContentType(contentType);
    }
View Full Code Here

    // ------------------------------------------------------- Protected Methods
    protected void populate(ActionContext context, ActionConfig actionConfig,
        ActionForm actionForm)
        throws Exception {
        ServletActionContext saContext = (ServletActionContext) context;

        RequestUtils.populate(actionForm, actionConfig.getPrefix(),
            actionConfig.getSuffix(), saContext.getRequest());
    }
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.