當前位置: 首頁>>代碼示例>>Java>>正文


Java Action類代碼示例

本文整理匯總了Java中org.apache.struts.action.Action的典型用法代碼示例。如果您正苦於以下問題:Java Action類的具體用法?Java Action怎麽用?Java Action使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Action類屬於org.apache.struts.action包,在下文中一共展示了Action類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeAction

import org.apache.struts.action.Action; //導入依賴的package包/類
private ExecutionResult executeAction(final HttpServletRequest request, final HttpServletResponse response, final Action action, final ActionForm form, final ActionMapping mapping) throws IOException, ServletException {
    // Open a new read-write connection
    try {
        openReadWriteConnection(request);
    } catch (final Exception e) {
        throw new SystemOfflineException();
    }

    // Execute the actual action
    final ExecutionResult result = doExecuteAction(request, response, action, form, mapping);

    // Commit or rollback transaction if the current request does not need a long transaction
    if (!result.longTransaction) {
        commitOrRollbackTransaction(request);
    } else {
        logDebug(request, "Keeping connection open because there are open iterators");
    }
    return result;
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:20,代碼來源:CyclosRequestProcessor.java

示例2: processActionCreate

import org.apache.struts.action.Action; //導入依賴的package包/類
@Override
protected Action processActionCreate(
	HttpServletRequest request,
	HttpServletResponse response,
	ActionMapping mapping) throws IOException {

	Action action = null;

	try {
		action = new A3ActionWrapper(((S2ActionMapping) mapping));
		action.setServlet(this.servlet);
		return action;
	} catch (Exception e) {
		log.error(getInternal().getMessage("actionCreate", mapping.getPath()), e);
		response.sendError(
			HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getInternal().getMessage("actionCreate", mapping.getPath()));
		return null;
	}
}
 
開發者ID:ardito-jp,項目名稱:sastruts-extension,代碼行數:20,代碼來源:A3RequestProcessor.java

示例3: testProcessActionCreateHttpServletRequestHttpServletResponseActionMapping

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Test of {@link A3RequestProcessor#processActionCreate(HttpServletRequest, HttpServletResponse, ActionMapping)}.
 */
@Test
@Ignore
public final void testProcessActionCreateHttpServletRequestHttpServletResponseActionMapping() {

	HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
	HttpServletResponse response = EasyMock.createMock(HttpServletResponse.class);
	ActionMapping mapping = new S2ActionMapping();

	try {
		Action action = this.processor.processActionCreate(request, response, mapping);
		assertNotNull(action);
		// 要実裝・・・
	} catch (IOException ioe) {
		fail();
	}

}
 
開發者ID:ardito-jp,項目名稱:sastruts-extension,代碼行數:21,代碼來源:A3RequestProcessorTest.java

示例4: processFormActionAndForward

import org.apache.struts.action.Action; //導入依賴的package包/類
public void processFormActionAndForward(final HttpServletRequest request, final HttpServletResponse response, final ActionMapping mapping) throws ServletException, IOException {
  	ActionForm form = processActionForm(request, response, mapping);
      processPopulate(request, response, form, mapping);

      // Create or acquire the Action instance to process this request
Action action = processActionCreate(request, response, mapping);

      if (action != null) {
          // Call the Action instance itself
    ActionForward forward = processActionPerform(request, response, action, form, mapping);

          if (forward != null) {
              if (forward.getRedirect() && forward.getName()!= null && forward.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME)) {
                  LOG.info("Attempt to open a document with a status of \"Initiated\" detected");
                  return;
              }
              // ProcessDefinition the returned ActionForward instance
	    processForwardConfig(request, response, forward);
          }
      }
  }
 
開發者ID:kuali,項目名稱:rice,代碼行數:22,代碼來源:KualiRequestProcessor.java

示例5: testSelectAll

import org.apache.struts.action.Action; //導入依賴的package包/類
public void testSelectAll() throws Exception {
    Action action = new VisibleSystemsListAction();
    ActionHelper ah = new ActionHelper();
    ah.setUpAction(action);
    ah.setupClampListBounds();


    User user = ah.getUser();
    user.addPermanentRole(RoleFactory.ORG_ADMIN);
    TestUtils.saveAndFlush(user);
    ServerFactoryTest.createTestServer(user, true,
                    ServerConstants.getServerGroupTypeEnterpriseEntitled());

    ah.getRequest().setupAddParameter("newset", (String[]) null);
    ah.getRequest().setupAddParameter("items_on_page", (String[]) null);
    ah.getRequest().setupAddParameter("items_selected", (String[]) null);
    ah.getRequest().setupAddParameter("uid", user.getId().toString());

    RhnSetDecl.SYSTEMS.clear(user);
    assertTrue(0 == RhnSetDecl.SYSTEMS.get(user).size());
    ah.executeAction("selectall");
    assertTrue(0 < RhnSetDecl.SYSTEMS.get(user).size());
}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:24,代碼來源:VisibleSystemsListActionTest.java

示例6: setUpAction

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
* Setup the Action with the proper Request, Form, Response.  With this version
* of the method we allow the caller to specify the expected name of the Forward
* the Action should generate.
*
* @param actionIn The Action we want to setup to test.
* @param expectedForwardName expected name of the forward you want the Action
*        to generate.
* @throws Exception if error occurs setting up the Action.
*/
public void setUpAction(Action actionIn, String expectedForwardName) throws Exception {
    action = actionIn;
    mapping = new ActionMapping();
    setExpectedForward(expectedForwardName);
    form = new RhnMockDynaActionForm();
    request = TestUtils.getRequestWithSessionAndUser();
    request.setLocale(Locale.getDefault());
    response = new RhnMockHttpServletResponse();

    RequestContext requestContext = new RequestContext(request);

    user = UserManager.lookupUser(requestContext.getCurrentUser(),
            requestContext.getParamAsLong("uid"));
    request.setAttribute(RhnHelper.TARGET_USER, user);
    // we have to get the actual user here so we can call setupAddParamter
    // a second time.  The MockRequest counts the number of times getParamter
    // is called.
    request.setupAddParameter("uid", user.getId().toString());

}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:31,代碼來源:ActionHelper.java

示例7: processActionCreate

import org.apache.struts.action.Action; //導入依賴的package包/類
@Override
protected Action processActionCreate(HttpServletRequest request,
        HttpServletResponse response, ActionMapping mapping)
        throws IOException {

    Action action = null;
    try {
        action = new ActionWrapper(((S2ActionMapping) mapping));
    } catch (Exception e) {
        log.error(getInternal().getMessage("actionCreate",
                mapping.getPath()), e);
        response
                .sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                        getInternal().getMessage("actionCreate",
                                mapping.getPath()));
        return null;
    }
    action.setServlet(servlet);
    return action;
}
 
開發者ID:seasarorg,項目名稱:sa-struts,代碼行數:21,代碼來源:S2RequestProcessor.java

示例8: EventActionDispatcher

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Constructs a new object for the specified action.
 * @param action the action
 */
public EventActionDispatcher(Action action) {
    // N.B. MAPPING_FLAVOR causes the getParameter() method
    //      in ActionDispatcher to throw an exception if the
    //      parameter is missing
    super(action, ActionDispatcher.MAPPING_FLAVOR);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:EventActionDispatcher.java

示例9: execute

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * <p>Invoke the appropriate <code>Action</code> for this request, and
 * cache the returned <code>ActionForward</code>.</p>
 *
 * @param actionCtx The <code>Context</code> for the current request
 * @return <code>false</code> so that processing continues
 * @throws Exception if thrown by the Action class
 */
public boolean execute(ActionContext actionCtx)
    throws Exception {
    // Skip processing if the current request is not valid
    Boolean valid = actionCtx.getFormValid();

    if ((valid == null) || !valid.booleanValue()) {
        return (false);
    }

    // Acquire the resources we will need to send to the Action
    Action action = actionCtx.getAction();

    if (action == null) {
        return (false);
    }

    ActionConfig actionConfig = actionCtx.getActionConfig();
    ActionForm actionForm = actionCtx.getActionForm();

    // Execute the Action for this request, caching returned ActionForward
    ForwardConfig forwardConfig =
        execute(actionCtx, action, actionConfig, actionForm);

    actionCtx.setForwardConfig(forwardConfig);

    return (false);
}
 
開發者ID:SonarSource,項目名稱:sonar-scanner-maven,代碼行數:36,代碼來源:AbstractExecuteAction.java

示例10: processActionCreate

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Override action creation to inject spring beans
 */
@Override
protected Action processActionCreate(final HttpServletRequest request, final HttpServletResponse response, final ActionMapping actionMapping) throws IOException {
    synchronized (actions) {
        Action action = (Action) actions.get(actionMapping.getType());
        if (action != null) {
            return action;
        } else {
            action = super.processActionCreate(request, response, actionMapping);

            if (action == null) {
                return null;
            }

            // Register the action as listener
            if (action instanceof LocalSettingsChangeListener) {
                settingsService.addListener((LocalSettingsChangeListener) action);
            }

            // Inject the required beans
            try {
                SpringHelper.injectBeans(getServletContext(), action);
            } catch (final Exception e) {
                // we must remove the already added action instance (by super.processActionCreate(...))
                actions.remove(actionMapping.getType());
                LOG.error("Error injecting beans on " + action, e);
                throw new IllegalStateException(e);
            }

            return action;
        }
    }
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:36,代碼來源:CyclosRequestProcessor.java

示例11: execute

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Pass the execute call on to the Spring-managed delegate {@code Action}.
 * @see #getDelegateAction
 */
@Override
public ActionForward execute(
		ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
		throws Exception {

	Action delegateAction = getDelegateAction(mapping);
	return delegateAction.execute(mapping, form, request, response);
}
 
開發者ID:Gert-Jan1966,項目名稱:spring-struts-forwardport,代碼行數:13,代碼來源:DelegatingActionProxy.java

示例12: processActionCreate

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Extend the base class method to autowire each created Action instance.
 * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory#autowireBeanProperties
 */
@Override
protected Action processActionCreate(
		HttpServletRequest request, HttpServletResponse response, ActionMapping mapping)
		throws IOException {

	Action action = super.processActionCreate(request, response, mapping);
	getWebApplicationContext().getAutowireCapableBeanFactory().autowireBeanProperties(
			action, getAutowireMode(), getDependencyCheck());
	return action;
}
 
開發者ID:Gert-Jan1966,項目名稱:spring-struts-forwardport,代碼行數:15,代碼來源:AutowiringTilesRequestProcessor.java

示例13: processActionCreate

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Override the base class method to return the delegate action.
 * @see #getDelegateAction
 */
@Override
protected Action processActionCreate(
		HttpServletRequest request, HttpServletResponse response, ActionMapping mapping)
		throws IOException {

	Action action = getDelegateAction(mapping);
	if (action != null) {
		return action;
	}
	return super.processActionCreate(request, response, mapping);
}
 
開發者ID:Gert-Jan1966,項目名稱:spring-struts-forwardport,代碼行數:16,代碼來源:DelegatingRequestProcessor.java

示例14: collectBody

import org.apache.struts.action.Action; //導入依賴的package包/類
public static void collectBody(WebApplicationContext webApplicationContext) {
    List listEntryPath = new ArrayList();
    if (webApplicationContext != null &&
            webApplicationContext.getBeanDefinitionNames() != null &&
            webApplicationContext.getBeanDefinitionNames().length > 0) {
        for (int i = 0; i < webApplicationContext.getBeanDefinitionNames().length; i++) {
            String tmp = webApplicationContext.getBeanDefinitionNames()[i];
            if (tmp.startsWith("/")) {
                Action toAdd = (Action) webApplicationContext.getBean(tmp, Action.class);
                try {
                    Class c = Class.forName(toAdd.getClass().getName());
                    Method[] tabDeclared = c.getDeclaredMethods();
                    for (int m = 0; i < tabDeclared.length; i++) {
                        EntryPathData entry = new EntryPathData();
                        String resSignature = org.objectweb.asm.Type.getMethodDescriptor(tabDeclared[i]);
                        entry.setUri(tmp);
                        entry.setClassName(toAdd.getClass().getName());
                        entry.setMethodName(tabDeclared[m].getName());
                        entry.setSignatureName(resSignature);
                        List listEntryPathData = new ArrayList();
                        for (int j = 0; j < tabDeclared[m].getParameterTypes().length; j++) {
                            EntryPathParam param = new EntryPathParam();
                            param.setKey("");
                            param.setTypeParam(TypeParam.PARAM_DATA);
                            param.setValue(tabDeclared[m].getParameterTypes()[j].getName());
                            listEntryPathData.add(param);
                        }
                        entry.setListEntryPathData(listEntryPathData);
                        System.err.println(entry.toString());
                        listEntryPath.add(entry);
                    }
                } catch (ClassNotFoundException e) {
                    System.err.println("Error on invoke " + toAdd.getClass().getName());
                    e.printStackTrace();
                }
            }
        }
    }
    CoreEngine.getInstance().getFramework("STRUTS_SPRING_1").receiveData(listEntryPath);
}
 
開發者ID:highway-to-urhell,項目名稱:highway-to-urhell,代碼行數:41,代碼來源:Struts1WithSpringCollector.java

示例15: invoke

import org.apache.struts.action.Action; //導入依賴的package包/類
/**
 * Invoke the corresponding Java method for this step
 * @param mapping from current request
 * @param form from current request
 * @param ctx from current request
 * @param response from current request
 * @param target enclosing Struts action
 * @return Struts forward corresponding to this wizard step
 * @throws Exception something bad happened hopefully handled upstream
 */
public final ActionForward invoke(ActionMapping mapping, ActionForm form,
        RequestContext ctx, HttpServletResponse response,
        Action target) throws Exception {
    Object[] args = new Object[5];
    args[0] = mapping;
    args[1] = form;
    args[2] = ctx;
    args[3] = response;
    args[4] = this;
    return (ActionForward) this.wizardMethod.invoke(target, args);
}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:22,代碼來源:WizardStep.java


注:本文中的org.apache.struts.action.Action類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。