Package javax.servlet

Examples of javax.servlet.ServletContext


    InjectionAction actionBean = new InjectionAction();
    c.readAnnotations(actionBean.getClass());
    Map<String, InjectionWrapper> injectionHandlers = c.getInjectionMap();

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

    // this will be called when the injection context is inspected
    expect(request.getParameter("param")).andReturn("3");
    replay(request);
View Full Code Here


  @Test
  public void testInit() throws ServletException
  {

    ModuleConfig config = createMock(ModuleConfig.class);
    ServletContext context = createMock(ServletContext.class);
    ActionServlet servlet = createMock(ActionServlet.class);

    expect(servlet.getServletContext()).andReturn(context);
    expect(config.getPrefix()).andReturn("prefix");
View Full Code Here

  public void testProcessRegularAction() throws Exception
  {

    Action action = createMock(Action.class);
    ModuleConfig config = createMock(ModuleConfig.class);
    ServletContext context = createMock(ServletContext.class);
    ActionServlet servlet = createMock(ActionServlet.class);

    expect(servlet.getServletContext()).andReturn(context);
    expect(config.getPrefix()).andReturn("");
    expect(action.execute(null, null, (HttpServletRequest) null, (HttpServletResponse) null)).andReturn(null)
View Full Code Here

  @Test
  public void testProcessControllerAction() throws Exception
  {

    ModuleConfig config = createMock(ModuleConfig.class);
    ServletContext context = createMock(ServletContext.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ReadOnlyControllerAction action = createMock(ReadOnlyControllerAction.class);
    ControllerProcessorDelegate delegate = createMock(ControllerProcessorDelegate.class);

    expect(servlet.getServletContext()).andReturn(context);   
View Full Code Here

  public void test()
  {

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

    WebHelperImpl wc = new WebHelperImpl(request, context);

    // 1.
    request.setAttribute("name1", "value1");
    expect(request.getSession()).andReturn(session);
    session.setAttribute("name2", "value2");
    context.setAttribute("name3", "value3");

    // 2.
    request.removeAttribute("name1");
    expect(request.getSession(false)).andReturn(session);
    session.removeAttribute("name2");
    context.removeAttribute("name3");

    // 3.
    expect(request.getSession(false)).andReturn(null);

    replay(request);
View Full Code Here

    }
   
    ServletActionContext sc = (ServletActionContext) context;
    HttpServletRequest request = sc.getRequest();
    HttpServletResponse response = sc.getResponse();
    ServletContext servletContext = sc.getContext();
   
    ActionContext actionContext = actionContextFactory.createActionContext(request, response, servletContext,
        actionForm, (ActionMapping) actionConfig);

    ActionForward forward = null;
View Full Code Here

    InjectionAction actionBean = new InjectionAction();
    c.readAnnotations(actionBean.getClass());
    Map<String, InjectionWrapper> injectionHandlers = c.getInjectionMap();

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

    // this will be called when the injection context is inspected
    expect(request.getParameter("param")).andReturn("3");
    replay(request);
View Full Code Here

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      PortalContainer pContainer = PortalContainer.getInstance();
      ServletContext context = pContainer.getPortalContext();
      // Unregister the token cookie
      unregisterTokenCookie(req);
      // Clear the token cookie
      clearTokenCookie(req, resp);
      // This allows the customer to define another login page without changing the portal
      context.getRequestDispatcher("/login/jsp/login.jsp").include(req, resp);
   }
View Full Code Here

      //
      if (credentials == null)
      {
         PortalContainer pContainer = PortalContainer.getInstance();
         ServletContext context = pContainer.getPortalContext();

         //
         String token = getRememberMeTokenCookie(req);
         if (token != null)
         {
View Full Code Here

  private static Logger logger = Logger.getLogger(ViewIndividualHandler.class);

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws IOException, ServletException
  {
    ServletContext context = super.getServlet().getServletContext();
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(context))
        .getDataSource();
    HttpSession session = request.getSession();
    UserObject user = (UserObject)session.getAttribute("userobject");
    int individualId = user.getIndividualID();
View Full Code Here

TOP

Related Classes of javax.servlet.ServletContext

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.