Search in sources :

Example 6 with StringTagger

use of nl.nn.adapterframework.util.StringTagger in project iaf by ibissource.

the class ExecuteJdbcQuery method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    IniDynaActionForm executeJdbcQueryForm = (IniDynaActionForm) form;
    Cookie[] cookies = request.getCookies();
    if (null != cookies) {
        for (int i = 0; i < cookies.length; i++) {
            Cookie aCookie = cookies[i];
            if (aCookie.getName().equals(AppConstants.getInstance().getString("WEB_EXECJDBCCOOKIE_NAME", "WEB_EXECJDBCCOOKIE"))) {
                StringTagger cs = new StringTagger(aCookie.getValue());
                log.debug("restoring values from cookie: " + cs.toString());
                try {
                    executeJdbcQueryForm.set("jmsRealm", cs.Value("jmsRealm"));
                    executeJdbcQueryForm.set("queryType", cs.Value("queryType"));
                    executeJdbcQueryForm.set("resultType", cs.Value("resultType"));
                    executeJdbcQueryForm.set("query", cs.Value("query"));
                } catch (Exception e) {
                    log.warn("could not restore Cookie value's", e);
                }
            }
        }
    }
    List jmsRealms = JmsRealmFactory.getInstance().getRegisteredRealmNamesAsList();
    if (jmsRealms.size() == 0)
        jmsRealms.add("no realms defined");
    executeJdbcQueryForm.set("jmsRealms", jmsRealms);
    List queryTypes = new ArrayList();
    queryTypes.add("select");
    queryTypes.add("other");
    executeJdbcQueryForm.set("queryTypes", queryTypes);
    List resultTypes = new ArrayList();
    resultTypes.add("csv");
    resultTypes.add("xml");
    executeJdbcQueryForm.set("resultTypes", resultTypes);
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Cookie(javax.servlet.http.Cookie) ArrayList(java.util.ArrayList) StringTagger(nl.nn.adapterframework.util.StringTagger) ArrayList(java.util.ArrayList) List(java.util.List) IniDynaActionForm(nl.nn.adapterframework.webcontrol.IniDynaActionForm) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 7 with StringTagger

use of nl.nn.adapterframework.util.StringTagger in project iaf by ibissource.

the class BrowseJdbcTable method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    if (form == null) {
        log.debug(" Creating new browseJdbcTableForm bean under key " + mapping.getAttribute());
        IniDynaActionForm browseJdbcTableForm = new IniDynaActionForm();
        if ("request".equals(mapping.getScope())) {
            request.setAttribute(mapping.getAttribute(), form);
        } else {
            session.setAttribute(mapping.getAttribute(), form);
        }
    }
    IniDynaActionForm browseJdbcTableForm = (IniDynaActionForm) form;
    Cookie[] cookies = request.getCookies();
    if (null != cookies) {
        for (int i = 0; i < cookies.length; i++) {
            Cookie aCookie = cookies[i];
            if (aCookie.getName().equals(AppConstants.getInstance().getProperty("WEB_JDBCBROWSECOOKIE_NAME"))) {
                StringTagger cs = new StringTagger(aCookie.getValue());
                log.debug("restoring values from cookie: " + cs.toString());
                try {
                    browseJdbcTableForm.set("jmsRealm", cs.Value("jmsRealm"));
                    browseJdbcTableForm.set("tableName", cs.Value("tableName"));
                    browseJdbcTableForm.set("where", cs.Value("where"));
                    browseJdbcTableForm.set("order", cs.Value("order"));
                    browseJdbcTableForm.set("numberOfRowsOnly", new Boolean(cs.Value("numberOfRowsOnly")));
                    browseJdbcTableForm.set("rownumMin", new Integer(cs.Value("rownumMin")));
                    browseJdbcTableForm.set("rownumMax", new Integer(cs.Value("rownumMax")));
                } catch (Exception e) {
                    log.warn("could not restore Cookie value's", e);
                }
            }
        }
    }
    List jmsRealms = JmsRealmFactory.getInstance().getRegisteredRealmNamesAsList();
    if (jmsRealms.size() == 0)
        jmsRealms.add("no realms defined");
    browseJdbcTableForm.set("jmsRealms", jmsRealms);
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Cookie(javax.servlet.http.Cookie) StringTagger(nl.nn.adapterframework.util.StringTagger) List(java.util.List) IniDynaActionForm(nl.nn.adapterframework.webcontrol.IniDynaActionForm) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 8 with StringTagger

use of nl.nn.adapterframework.util.StringTagger in project iaf by ibissource.

the class BrowseQueue method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    if (form == null) {
        log.debug(" Creating new browseQueueForm bean under key [" + mapping.getAttribute() + "]");
        IniDynaActionForm browseQueueForm = new IniDynaActionForm();
        if ("request".equals(mapping.getScope())) {
            request.setAttribute(mapping.getAttribute(), form);
        } else {
            session.setAttribute(mapping.getAttribute(), form);
        }
    }
    IniDynaActionForm browseQueueForm = (IniDynaActionForm) form;
    Cookie[] cookies = request.getCookies();
    if (null != cookies) {
        for (int i = 0; i < cookies.length; i++) {
            Cookie aCookie = cookies[i];
            if (aCookie.getName().equals(AppConstants.getInstance().getString("WEB_QBROWSECOOKIE_NAME", "WEB_QBROWSECOOKIE"))) {
                StringTagger cs = new StringTagger(aCookie.getValue());
                log.debug("restoring values from cookie: " + cs.toString());
                try {
                    browseQueueForm.set("jmsRealm", cs.Value("jmsRealm"));
                    browseQueueForm.set("destinationName", cs.Value("destinationName"));
                    browseQueueForm.set("destinationType", cs.Value("destinationType"));
                    browseQueueForm.set("numberOfMessagesOnly", new Boolean(cs.Value("numberOfMessagesOnly")));
                    browseQueueForm.set("showPayload", new Boolean(cs.Value("showPayload")));
                } catch (Exception e) {
                    log.warn("could not restore Cookie value's", e);
                }
            }
        }
    }
    List jmsRealms = JmsRealmFactory.getInstance().getRegisteredRealmNamesAsList();
    if (jmsRealms.size() == 0)
        jmsRealms.add("no realms defined");
    browseQueueForm.set("jmsRealms", jmsRealms);
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Cookie(javax.servlet.http.Cookie) StringTagger(nl.nn.adapterframework.util.StringTagger) List(java.util.List) IniDynaActionForm(nl.nn.adapterframework.webcontrol.IniDynaActionForm) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

Cookie (javax.servlet.http.Cookie)8 StringTagger (nl.nn.adapterframework.util.StringTagger)8 IOException (java.io.IOException)6 ServletException (javax.servlet.ServletException)6 List (java.util.List)5 IniDynaActionForm (nl.nn.adapterframework.webcontrol.IniDynaActionForm)5 ActionForward (org.apache.struts.action.ActionForward)4 DynaActionForm (org.apache.struts.action.DynaActionForm)3 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 Transformer (javax.xml.transform.Transformer)2 DirectQuerySender (nl.nn.adapterframework.jdbc.DirectQuerySender)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ResultSet (java.sql.ResultSet)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1 IMessageBrowser (nl.nn.adapterframework.core.IMessageBrowser)1 IMessageBrowsingIterator (nl.nn.adapterframework.core.IMessageBrowsingIterator)1 ListenerException (nl.nn.adapterframework.core.ListenerException)1 JmsMessageBrowser (nl.nn.adapterframework.jms.JmsMessageBrowser)1