Package javax.servlet.http

Examples of javax.servlet.http.HttpSession


{
  private static Logger logger = Logger.getLogger(DeleteMessage.class);
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, CommunicationException, NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession(true);
    int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
    ArrayList deleteLog = new ArrayList();
    String rowId[] = request.getParameterValues("rowId");
    String folderId = request.getParameter("folderId");
    ArrayList resultDeleteLog = new ArrayList();
    MailHome mailHome = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");

    try {
      Mail remoteMail = mailHome.create();
      remoteMail.setDataSource(dataSource);
      for (int i = 0; i < rowId.length; i++) {
        if (rowId[i] != null && ! rowId[i].equals("")) {
          int elementID = Integer.parseInt(rowId[i]);
          try {
            int numberDeleted = remoteMail.deleteMessage(elementID, individualId);
          } catch(RemoteException re) {
            logger.error("[execute] Exception thrown.", re);
          }
        }
      }
    } catch(CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new CommunicationException(e.getMessage());
    } catch(RemoteException re) {
      logger.error("[execute] Exception thrown.", re);
    }

    if (! deleteLog.isEmpty()) {
      ActionErrors allErrors = new ActionErrors();
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You do not have permission to delete one or more of the records you selected."));
      session.setAttribute("listErrorMessage", allErrors);
    }

    // When deleteing a message we are either on the detail page
    // or on the list page.  On the list we forward back to the list
    // on the detail we display the next message (maybe)
View Full Code Here


   */
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)   throws IOException, ServletException, CommunicationException, NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

      HttpSession session = request.getSession(true);

      GlobalMasterLists gml = GlobalMasterLists.getGlobalMasterLists(dataSource);
      Vector vecMOC = (Vector)gml.get("MOC");

      int listid = 0;

      if (session.getAttribute("listid") != null)
      {
        listid = Integer.parseInt((String)session.getAttribute("listid"));
      }

      ListMemberForm dyn = (ListMemberForm)session.getAttribute("importListForm");
      UserObject userobject = (UserObject)session.getAttribute("userobject");

      int indvID = 0;

      if (userobject != null)
      {
        indvID = userobject.getIndividualID();
      }

      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("Entity");
      lg.makeListDirty("Individual");

      RandomAccessFile ral = new RandomAccessFile(new File(dyn.getFilePath()), "r");

      String readline = "";
      int i = 0;
      //field seperator
      String seperator = dyn.getFieldseprator();

      Vector importList = new Vector();
      Vector headerVector = new Vector();

      String s = "";
      String hasHeader = dyn.getHeaderrow();

      String sFileFieldName = "";

      int headerRow = 0;

      String tabDelimiter = dyn.getFieldseprator();
      String lineDelimiter = dyn.getLineseprator();
      if (tabDelimiter.equals(""))
      {
        tabDelimiter = dyn.getTab();
      }
      if (lineDelimiter.equals(""))
      {
        lineDelimiter = dyn.getLine();
      }

      String headLine = "";
      if (hasHeader.equals("Yes"))
      {
        headLine = ral.readLine();
        headerRow++;
      }

      int iTemp = 0;

      Vector listVector = dyn.getHeadervector();
      int vectorColCounter = 0;

      while ((readline = ral.readLine()) != null)
      {

        String[] lineSeprator = readline.split(lineDelimiter);
        for (int j = 0; j < lineSeprator.length; j++)
        {
          HashMap hm = new HashMap();
          int headerLen = listVector.size();
          String[] sFileFieldList = lineSeprator[j].split(tabDelimiter, (listVector.size() + 1));
          vectorColCounter = 0;
          int fieldLen = sFileFieldList.length;
          if (fieldLen == headerLen)
          {
            for (int k = 0; k < sFileFieldList.length; k++)
            {
              DDNameValue ddnamevalue = (DDNameValue)listVector.get(vectorColCounter);
              String name = ddnamevalue.getName() + vectorColCounter;
              String defValue = ddnamevalue.getName() + "DefaultValue" + vectorColCounter;
              String sDBFieldName = (String)request.getParameter(name);
              String defaultValue = (String)request.getParameter(defValue);
              if (sDBFieldName != null && !(sDBFieldName.equals("--- Select ---")))
              {

                String defaultNameList = sFileFieldList[k];
                if (defaultNameList == null && defaultValue != null)
                {
                  defaultNameList = defaultValue;
                } // end of if

                if (defaultNameList != null && defaultNameList.equals("") && defaultValue != null)
                {
                  defaultNameList = defaultValue;
                } // end of if

                defaultNameList = defaultNameList.replaceAll("\"", "");
                hm.put(sDBFieldName, defaultNameList.trim());
              } // end if block  to not allow (sDBFieldName.equals("--- Select ---")) and null
              vectorColCounter++;
            } // end of for block  used to parse every tabSeprator
          } //end of if block (fieldLen==headerLen)
          hm.put("Line", readline);
          importList.add(hm);
        } // end of for block  used to parse every lineSeprator
      } // end of while

      Collection CustomEntList = dyn.getCustomEntityList();
      Collection CustomIndList = dyn.getCustomIndividualList();

      if (tabDelimiter != null && tabDelimiter.equals("\\t"))
      {
        tabDelimiter = "\t";
      }

      if (lineDelimiter != null && lineDelimiter.equals("\\n"))
      {
        lineDelimiter = "\n";
      }

      //We will check for the instance of the BackgroundImportMembers. and start the import process in background
      BackgroundImportMembers backgroundImportMembers = (BackgroundImportMembers)session.getAttribute("backgroundImportMembers");
    if (backgroundImportMembers == null || !backgroundImportMembers.isAlive())
    {
    backgroundImportMembers = new BackgroundImportMembers(importList, headerRow, listid,
                indvID, CustomEntList, CustomIndList, tabDelimiter,
                lineDelimiter, headLine, dataSource,
                "backgroundImportMembers"+indvID);
    backgroundImportMembers.start();
    HashMap importMessage = backgroundImportMembers.getImportedMessages();
    request.setAttribute("Message", importMessage);
    session.setAttribute("backgroundImportMembers", backgroundImportMembers);
    }
   
    StringBuffer returnPath = new StringBuffer();
    returnPath.append(mapping.findForward(".view.marketing.listmanager.importmember").getPath());
   
View Full Code Here

     *
     * @exception JspException if a JSP exception has occurred
     */
    public int doStartTag() throws JspException {

      HttpSession session = ((HttpServletRequest)(pageContext.getRequest())).getSession();
     
      ModuleFieldRightMatrix mfrmx = ((UserObject)session.getAttribute("userobject")).getUserPref().getModuleAuthorizationMatrix();
      HashMap hm = mfrmx.getFieldRights(getModulename());
     
      if (hm != null && hm.containsKey(getFieldname()))
      {
        fieldRight =  ((Integer)hm.get(getFieldname())).intValue();
View Full Code Here

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, CommunicationException, NamingException 
{
  String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();


    HttpSession session = request.getSession(true);

    if (session.getAttribute("highlightmodule") != null)
      session.setAttribute("highlightmodule", "support");//Highlights the note link on header.jsp

    com.centraview.common.UserObject  userobjectd = (com.centraview.common.UserObject)session.getAttribute( "userobject" );//get the user object
    int individualID = userobjectd.getIndividualID();
    ListPreference listpreference= userobjectd.getListPreference("FAQ");

      FAQList displaylistSession = null;
    FAQList displaylist = null;

    // After performing the logic in the DeleteHanlder, we are generat a new request for the list
    // So we will not be carrying the old error. So that we will try to collect the error from the Session variable
    // Then destory it after getting the Session value
    if (session.getAttribute("listErrorMessage") != null)
    {
      ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }//end of if (session.getAttribute("listErrorMessage") != null)
   
    try
    {
      displaylistSession = ( FAQList )session.getAttribute( "displaylist") ;//gets the list from session

    }
    catch( Exception e )
    {
      displaylistSession = null;
    }
    try
    {
      displaylist = ( FAQList )request.getAttribute( "displaylist") ;//gets the list from request
    }
    catch( Exception e )
    {
      displaylist = null;
    }



    FAQList DL = null ;
    ListGenerator lg = ListGenerator.getListGenerator(dataSource);

    if( displaylist == null  ) {
      int records = listpreference.getRecordsPerPage();//gets the initial record per page to be displayed from listPreference
      String sortelement = listpreference.getSortElement();//gets the initial sort element from listPreference
      DL = (FAQList )lg.getFAQList( individualID , 1, records , "" ,sortelement);//called when the request for the list is for first time
      DL = setLinksfunction( DL );
    }
    else //if(displaylistSession !=null)
    {
      String searchSession = displaylistSession.getSearchString();
      String searchrequest = displaylist.getSearchString();

      if(searchSession == null)
        searchSession = "";
      if(searchrequest == null)
        searchrequest = "";

      if (((displaylistSession.getListID() == displaylist.getListID() )
          && ( displaylist.getDirtyFlag() == false )
          && ( displaylist.getStartAT() >= displaylistSession.getBeginIndex() )
          && ( displaylist.getEndAT()<=displaylistSession.getEndIndex() )
          && (displaylist.getSortMember().equals(displaylistSession.getSortMember() ) )
          && (displaylist.getSortType()==(displaylistSession.getSortType())
          && (searchSession.equals(searchrequest))))
          || displaylist.getAdvanceSearchFlag() == true)
      {
        DL = (FAQList) displaylistSession;
      }else {
        DL = ( FAQList )lg.getFAQList( individualID , displaylist );
      }
      DL = setLinksfunction( DL );
    }
    session.setAttribute( "displaylist" , DL );
    request.setAttribute("displaylist" , DL );
    request.setAttribute(SupportConstantKeys.TYPEOFSUBMODULE,"FAQ");
    return ( mapping.findForward("showfaqlist") );
  }
View Full Code Here

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
      throws RuntimeException, IOException, ServletException, CommunicationException, NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    HttpSession session = request.getSession();
    UserObject userObject = (UserObject) session.getAttribute("userobject");

    int individualID = userObject.getIndividualID(); // logged in user

    ActionErrors allErrors = new ActionErrors();
    String forward = "displayComposeForm";
View Full Code Here

   */
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException
  {
    try {
      String rowId[] = null;
      HttpSession session = request.getSession(true);
      rowId = request.getParameterValues("rowId");
      if (rowId != null) {
        int[] reportIds = new int[rowId.length];
        int elementID = 0;
        for (int i = 0; i < rowId.length; i++) {
View Full Code Here

System.out.println("### View Ticket = [" + request.getAttribute("ticketId") + "] [" + request.getParameter("ticketId") + "]");   
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try {
      // get session
      HttpSession session = request.getSession();
      com.centraview.common.UserObject userobjectd = (com.centraview.common.UserObject)session.getAttribute("userobject"); //get the user object

      int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      int ticketId = 0;

      if (request.getAttribute("ticketId") != null) {
        ticketId = ((Integer) (request.getAttribute("ticketId"))).intValue();
      } else {
View Full Code Here

   */
  public void setTitle()
  {
    setCompanyname("CentraView");
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    HttpSession session = request.getSession(true);
    title = "<title> ";

    if (session.getAttribute("userName") != null)
    {
      setUsername(session.getAttribute("userName").toString());
      title += (companyname + ":" + username);
    }
    else
    {
      title += companyname;
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try
    {
      HttpSession session = request.getSession(true);
      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int individualid = userobjectd.getIndividualID();
      int eventid = Integer.parseInt(request.getParameter("eventid").toString());

      HashMap mapEvent = new HashMap();
      mapEvent.put("eventid", "" + eventid);
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try
    {
   
      HttpSession session=request.getSession(true);
     
      com.centraview.common.UserObject  userobjectd = (com.centraview.common.UserObject)session.getAttribute( "userobject" );//get the user object
            int individualID = userobjectd.getIndividualID();//get the individualId of the user logged in
     
   
      FolderForm folderForm=(FolderForm)form;
     
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpSession

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.