Search in sources :

Example 6 with IniDynaActionForm

use of nl.nn.adapterframework.webcontrol.IniDynaActionForm 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)6 IniDynaActionForm (nl.nn.adapterframework.webcontrol.IniDynaActionForm)6 IOException (java.io.IOException)5 List (java.util.List)5 ServletException (javax.servlet.ServletException)5 StringTagger (nl.nn.adapterframework.util.StringTagger)5 ArrayList (java.util.ArrayList)2 ActionForward (org.apache.struts.action.ActionForward)2 URL (java.net.URL)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Iterator (java.util.Iterator)1 Transformer (javax.xml.transform.Transformer)1 Adapter (nl.nn.adapterframework.core.Adapter)1 IAdapter (nl.nn.adapterframework.core.IAdapter)1 IMessageBrowser (nl.nn.adapterframework.core.IMessageBrowser)1 IMessageBrowsingIterator (nl.nn.adapterframework.core.IMessageBrowsingIterator)1 IPipe (nl.nn.adapterframework.core.IPipe)1 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)1 ListenerException (nl.nn.adapterframework.core.ListenerException)1