Package javax.servlet.http

Examples of javax.servlet.http.HttpServletRequest


  @Test
  public void test()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    ServletContext context = createStrictMock(ServletContext.class);

    InjectionAnnotationReader c = new InjectionAnnotationReader();
    ActionWithWebHelper action = new ActionWithWebHelper();
View Full Code Here


    ActionWithRedirectHelper action = new ActionWithRedirectHelper();

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = createMock(HttpServletRequest.class);
    RedirectHelper redirectHelper = createMock(RedirectHelper.class);

    expect(request.getAttribute(InfrastructureKeys.REDIRECT_HELPER)).andReturn(redirectHelper);

    replay(request);
    replay(redirectHelper);

    InjectionWrapper inputWrapper = inputs.get("redirectHelper");
View Full Code Here

    ActionWithRedirectHelper action = new ActionWithRedirectHelper();

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = createMock(HttpServletRequest.class);
    RedirectHelperImpl redirectHelper = createNiceMock(RedirectHelperImpl.class);

    expect(request.getAttribute(InfrastructureKeys.REDIRECT_HELPER)).andReturn(null);
    request.setAttribute(eq(InfrastructureKeys.REDIRECT_HELPER), isA(RedirectHelper.class));

    replay(request);
    replay(redirectHelper);

    InjectionWrapper inputWrapper = inputs.get("redirectHelper");
View Full Code Here

  @Test
  public void test()
  {

    HttpServletRequest request = EasyMock.createStrictMock(HttpServletRequest.class);
    RequestParameterInjectionHandler handler = new RequestParameterInjectionHandler("paramName",
        new IntToIntConverter(), true);

    expect(request.getParameter("paramName")).andReturn("1");

    replay(request);

    try
    {
View Full Code Here

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    Locale locale = Locale.getDefault();
   
    HttpServletRequest request = createMock(HttpServletRequest.class);
    expect(request.getAttribute(Globals.LOCALE_KEY)).andReturn(locale);
   
    replay(request);

    InjectionWrapper inputWrapper = inputs.get("locale");
View Full Code Here

    ActionWithRequest action = new ActionWithRequest();

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletRequest request = createMock(HttpServletRequest.class);

    replay(request);

    InjectionWrapper inputWrapper = inputs.get("request");
View Full Code Here

    BasicDispatchController action = new BasicDispatchController();
    ActionForward actionForward = new ActionForward();

    SimpleDispatchAction actionBean = createMock(SimpleDispatchAction.class);
    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);

    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("insert");
    expect(actionBean.insert()).andReturn("insertResult");
    expect(mapping.findForward("insertResult")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
View Full Code Here

    BasicDispatchController action = new BasicDispatchController();
    ActionForward actionForward = new ActionForward();

    SimpleDispatchAction actionBean = createMock(SimpleDispatchAction.class);
    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);

    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn(null);
    expect(actionBean.unspecified()).andReturn("unspecifiedResult");
    expect(mapping.findForward("unspecifiedResult")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
View Full Code Here

    BasicDispatchController action = new BasicDispatchController();

    SimpleDispatchAction actionBean = createMock(SimpleDispatchAction.class);
    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);

    expect(mapping.getParameter()).andReturn(null);
    expect(mapping.getPath()).andReturn("path");

    replay(actionBean);
View Full Code Here

  @Test
  public void testHandleActionPerform() throws Exception
  {

    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);

    // check the expected order of method invocation
    expect(action.getBeanSource()).andReturn(beanSource);
    expect(beanSource.createBean(actionContext)).andReturn(actionBean);
    action.preExecute(actionBean, actionContext);
    expect(action.getBeforeInterceptors()).andReturn(null);
    expect(action.executeController(actionBean, actionContext)).andReturn(null);
    expect(action.getAfterInterceptors()).andReturn(null);
    request.setAttribute(InfrastructureKeys.ACTION_BEAN, actionBean);
    // request.setAttribute(InfrastructureKeys.ACTION_FORWARD, null);
    action.postExecute(actionBean, actionContext, null);

    replay(action);
    replay(request);
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServletRequest

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.