Search in sources :

Example 6 with DynaActionForm

use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.

the class SendJmsMessageExecute method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    // -------------------------------
    if (isCancelled(request)) {
        log.debug("sendJmsMessage was cancelled");
        removeFormBean(mapping, request);
        return (mapping.findForward("success"));
    }
    // Retrieve form content
    // ---------------------
    DynaActionForm sendJmsMessageForm = (DynaActionForm) form;
    String form_jmsRealm = (String) sendJmsMessageForm.get("jmsRealm");
    String form_destinationName = (String) sendJmsMessageForm.get("destinationName");
    String form_destinationType = (String) sendJmsMessageForm.get("destinationType");
    boolean form_persistent = false;
    if (null != sendJmsMessageForm.get("persistent")) {
        form_persistent = ((Boolean) sendJmsMessageForm.get("persistent")).booleanValue();
    }
    String form_message = (String) sendJmsMessageForm.get("message");
    FormFile form_file = (FormFile) sendJmsMessageForm.get("file");
    String form_replyToName = (String) sendJmsMessageForm.get("replyToName");
    // if upload is choosen, it prevails over the message
    if ((form_file != null) && (form_file.getFileSize() > 0)) {
        log.debug("Upload of file [" + form_file.getFileName() + "] ContentType[" + form_file.getContentType() + "]");
        if (FileUtils.extensionEqualsIgnoreCase(form_file.getFileName(), "zip")) {
            ZipInputStream archive = new ZipInputStream(new ByteArrayInputStream(form_file.getFileData()));
            for (ZipEntry entry = archive.getNextEntry(); entry != null; entry = archive.getNextEntry()) {
                String name = entry.getName();
                int size = (int) entry.getSize();
                if (size > 0) {
                    byte[] b = new byte[size];
                    int rb = 0;
                    int chunk = 0;
                    while (((int) size - rb) > 0) {
                        chunk = archive.read(b, rb, (int) size - rb);
                        if (chunk == -1) {
                            break;
                        }
                        rb += chunk;
                    }
                    String currentMessage = XmlUtils.readXml(b, 0, rb, request.getCharacterEncoding(), false);
                    // initiate MessageSender
                    JmsSender qms = new JmsSender();
                    qms.setName("SendJmsMessageAction");
                    qms.setJmsRealm(form_jmsRealm);
                    qms.setDestinationName(form_destinationName);
                    qms.setPersistent(form_persistent);
                    qms.setDestinationType(form_destinationType);
                    if ((form_replyToName != null) && (form_replyToName.length() > 0))
                        qms.setReplyToName(form_replyToName);
                    processMessage(qms, name + "_" + Misc.createSimpleUUID(), currentMessage);
                }
                archive.closeEntry();
            }
            archive.close();
            form_message = null;
        } else {
            form_message = XmlUtils.readXml(form_file.getFileData(), request.getCharacterEncoding(), false);
        }
    } else {
        form_message = new String(form_message.getBytes(), Misc.DEFAULT_INPUT_STREAM_ENCODING);
    }
    if (form_message != null && form_message.length() > 0) {
        // initiate MessageSender
        JmsSender qms = new JmsSender();
        qms.setName("SendJmsMessageAction");
        qms.setJmsRealm(form_jmsRealm);
        qms.setDestinationName(form_destinationName);
        qms.setPersistent(form_persistent);
        qms.setDestinationType(form_destinationType);
        if ((form_replyToName != null) && (form_replyToName.length() > 0))
            qms.setReplyToName(form_replyToName);
        processMessage(qms, "testmsg_" + Misc.createUUID(), form_message);
    }
    StoreFormData(sendJmsMessageForm);
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        return (new ActionForward(mapping.getInput()));
    }
    // Successfull: store cookie
    String cookieValue = "";
    cookieValue += "jmsRealm=\"" + form_jmsRealm + "\"";
    // separator
    cookieValue += " ";
    cookieValue += "destinationName=\"" + form_destinationName + "\"";
    // separator
    cookieValue += " ";
    cookieValue += "destinationType=\"" + form_destinationType + "\"";
    Cookie sendJmsCookie = new Cookie(AppConstants.getInstance().getProperty("WEB_JMSCOOKIE_NAME"), cookieValue);
    sendJmsCookie.setMaxAge(Integer.MAX_VALUE);
    log.debug("Store cookie for " + request.getServletPath() + " cookieName[" + AppConstants.getInstance().getProperty("WEB_JMSCOOKIE_NAME") + "] " + " cookieValue[" + new StringTagger(cookieValue).toString() + "]");
    try {
        response.addCookie(sendJmsCookie);
    } catch (Throwable e) {
        log.warn("unable to add cookie to request. cookie value [" + sendJmsCookie.getValue() + "]");
    }
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Cookie(javax.servlet.http.Cookie) DynaActionForm(org.apache.struts.action.DynaActionForm) ZipEntry(java.util.zip.ZipEntry) StringTagger(nl.nn.adapterframework.util.StringTagger) ActionForward(org.apache.struts.action.ActionForward) FormFile(org.apache.struts.upload.FormFile) ZipInputStream(java.util.zip.ZipInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) JmsSender(nl.nn.adapterframework.jms.JmsSender)

Example 7 with DynaActionForm

use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.

the class ShowEnvironmentVariables method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    if (ibisManager == null)
        return (mapping.findForward("noIbisContext"));
    DynaActionForm configurationPropertiesForm = getPersistentForm(mapping, form, request);
    Logger rl = LogUtil.getRootLogger();
    configurationPropertiesForm.set("logLevel", rl.getLevel().toString());
    configurationPropertiesForm.set("logIntermediaryResults", new Boolean(false));
    if (AppConstants.getInstance().getResolvedProperty("log.logIntermediaryResults") != null) {
        if (AppConstants.getInstance().getResolvedProperty("log.logIntermediaryResults").equalsIgnoreCase("true")) {
            configurationPropertiesForm.set("logIntermediaryResults", new Boolean(true));
        }
    }
    Appender appender = rl.getAppender("appwrap");
    if (appender != null && appender instanceof IbisAppenderWrapper) {
        IbisAppenderWrapper iaw = (IbisAppenderWrapper) appender;
        configurationPropertiesForm.set("lengthLogRecords", iaw.getMaxMessageLength());
    } else {
        configurationPropertiesForm.set("lengthLogRecords", -1);
    }
    // Retrieve environment variables for browsing
    XmlBuilder configurationsXml = new XmlBuilder("configurations");
    List<Configuration> configurations = ibisManager.getConfigurations();
    for (Configuration configuration : configurations) {
        XmlBuilder configurationXml = new XmlBuilder("configuration");
        configurationXml.setValue(configuration.getConfigurationName());
        configurationXml.addAttribute("nameUC", Misc.toSortName(configuration.getConfigurationName()));
        configurationsXml.addSubElement(configurationXml);
    }
    request.setAttribute("configurations", configurationsXml.toXML());
    Configuration configuration;
    String configurationName = request.getParameter("configuration");
    if (configurationName == null) {
        configurationName = (String) request.getSession().getAttribute("configurationName");
    }
    if (configurationName == null || configurationName.equalsIgnoreCase(CONFIG_ALL) || ibisManager.getConfiguration(configurationName) == null) {
        configuration = configurations.get(0);
        request.getSession().setAttribute("configurationName", configuration.getName());
    } else {
        configuration = ibisManager.getConfiguration(configurationName);
        request.getSession().setAttribute("configurationName", configuration.getName());
    }
    List<String> propsToHide = new ArrayList<String>();
    String propertiesHideString = AppConstants.getInstance(configuration.getClassLoader()).getString("properties.hide", null);
    if (propertiesHideString != null) {
        propsToHide.addAll(Arrays.asList(propertiesHideString.split("[,\\s]+")));
    }
    XmlBuilder envVars = new XmlBuilder("environmentVariables");
    addPropertiesToXmlBuilder(envVars, AppConstants.getInstance(configuration.getClassLoader()), "Application Constants", propsToHide, true);
    addPropertiesToXmlBuilder(envVars, System.getProperties(), "System Properties", propsToHide);
    try {
        addPropertiesToXmlBuilder(envVars, Misc.getEnvironmentVariables(), "Environment Variables");
    } catch (Throwable t) {
        log.warn("caught Throwable while getting EnvironmentVariables", t);
    }
    addPropertiesToXmlBuilder(envVars, JdbcUtil.retrieveJdbcPropertiesFromDatabase(), "Jdbc Properties", propsToHide);
    request.setAttribute("envVars", envVars.toXML());
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Appender(org.apache.log4j.Appender) DynaActionForm(org.apache.struts.action.DynaActionForm) Configuration(nl.nn.adapterframework.configuration.Configuration) ArrayList(java.util.ArrayList) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder) Logger(org.apache.log4j.Logger) IbisAppenderWrapper(nl.nn.adapterframework.extensions.log4j.IbisAppenderWrapper)

Example 8 with DynaActionForm

use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.

the class ShowMonitors method debugFormData.

public void debugFormData(HttpServletRequest request, ActionForm form) {
    for (Enumeration enumeration = request.getParameterNames(); enumeration.hasMoreElements(); ) {
        String name = (String) enumeration.nextElement();
        String[] values = request.getParameterValues(name);
        if (values.length == 1) {
            log.debug("Parameter [" + name + "] value [" + values[0] + "]");
        } else {
            for (int i = 0; i < values.length; i++) {
                log.debug("Parameter [" + name + "][" + i + "] value [" + values[i] + "]");
            }
        }
    }
    if (form instanceof DynaActionForm) {
        DynaActionForm daf = (DynaActionForm) form;
        log.debug("class [" + daf.getDynaClass().getName() + "]");
        for (Iterator it = daf.getMap().keySet().iterator(); it.hasNext(); ) {
            String key = (String) it.next();
            Object value = daf.get(key);
            log.debug("key [" + key + "] class [" + ClassUtils.nameOf(value) + "] value [" + value + "]");
            if (value != null) {
                if (value instanceof Monitor) {
                    Monitor monitor = (Monitor) value;
                    log.debug("Monitor :" + monitor.toXml().toXML());
                }
            }
        }
    }
}
Also used : Enumeration(java.util.Enumeration) DynaActionForm(org.apache.struts.action.DynaActionForm) Monitor(nl.nn.adapterframework.monitoring.Monitor) Iterator(java.util.Iterator)

Example 9 with DynaActionForm

use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.

the class TestServiceExecute method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    DynaActionForm serviceTestForm = (DynaActionForm) form;
    // List form_services = (List) serviceTestForm.get("services");
    String form_serviceName = (String) serviceTestForm.get("serviceName");
    String form_message = (String) serviceTestForm.get("message");
    String form_result = (String) serviceTestForm.get("message");
    FormFile form_file = (FormFile) serviceTestForm.get("file");
    // if no message and no formfile, send an error
    if ((form_message == null) || (form_message.length() == 0)) {
        if ((form_file == null) || (form_file.getFileSize() == 0)) {
            storeFormData(null, null, serviceTestForm);
            warn("Nothing to send or test");
        }
    }
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        storeFormData(null, null, serviceTestForm);
        return (new ActionForward(mapping.getInput()));
    }
    if ((form_serviceName == null) || (form_serviceName.length() == 0)) {
        warn("No service selected");
    }
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        storeFormData(null, form_message, serviceTestForm);
        return (new ActionForward(mapping.getInput()));
    }
    // Execute the request
    if (!(ServiceDispatcher.getInstance().isRegisteredServiceListener(form_serviceName)))
        warn("Servicer with specified name [" + form_serviceName + "] is not registered at the Dispatcher");
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        storeFormData(null, form_message, serviceTestForm);
        return (new ActionForward(mapping.getInput()));
    }
    // if upload is choosen, it prevails over the message
    if ((form_file != null) && (form_file.getFileSize() > 0)) {
        form_message = XmlUtils.readXml(form_file.getFileData(), request.getCharacterEncoding(), false);
        log.debug("Upload of file [" + form_file.getFileName() + "] ContentType[" + form_file.getContentType() + "]");
    } else {
        form_message = new String(form_message.getBytes(), Misc.DEFAULT_INPUT_STREAM_ENCODING);
    }
    form_result = "";
    // Execute the request
    try {
        Map context = new HashMap();
        form_result = ServiceDispatcher.getInstance().dispatchRequest(form_serviceName, null, form_message, context);
    } catch (Exception e) {
        warn("Service with specified name [" + form_serviceName + "] got error", e);
    }
    storeFormData(form_result, form_message, serviceTestForm);
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        return (new ActionForward(mapping.getInput()));
    }
    // Forward control to the specified success URI
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : DynaActionForm(org.apache.struts.action.DynaActionForm) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ActionForward(org.apache.struts.action.ActionForward) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) FormFile(org.apache.struts.upload.FormFile)

Example 10 with DynaActionForm

use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.

the class Browse method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    DynaActionForm browseForm = getPersistentForm(mapping, form, request);
    String submit = request.getParameter("submit");
    log.debug("submit param [" + submit + "]");
    String maxMessagesStr = getAndSetProperty(request, browseForm, "maxMessages", getMaxMessages() + "");
    String skipMessagesStr = getAndSetProperty(request, browseForm, "skipMessages", "0");
    String action = getAndSetProperty(request, browseForm, "action");
    String storageType = getAndSetProperty(request, browseForm, "storageType");
    String adapterName = getAndSetProperty(request, browseForm, "adapterName");
    String receiverName = getAndSetProperty(request, browseForm, "receiverName");
    String pipeName = getAndSetProperty(request, browseForm, "pipeName");
    String messageId = getAndSetProperty(request, browseForm, "messageId");
    String typeMask = getAndSetProperty(request, browseForm, "typeMask");
    String hostMask = getAndSetProperty(request, browseForm, "hostMask");
    String currentIdMask = getAndSetProperty(request, browseForm, "currentIdMask");
    String messageIdMask = getAndSetProperty(request, browseForm, "messageIdMask");
    String correlationIdMask = getAndSetProperty(request, browseForm, "correlationIdMask");
    String commentMask = getAndSetProperty(request, browseForm, "commentMask");
    String messageTextMask = getAndSetProperty(request, browseForm, "messageTextMask");
    String labelMask = getAndSetProperty(request, browseForm, "labelMask");
    String startDateStr = getAndSetProperty(request, browseForm, "insertedAfter");
    String startDateClipStr = getAndSetProperty(request, browseForm, "insertedAfterClip");
    // not yet supported in actionForm
    String endDateStr = request.getParameter("insertedBefore");
    // not yet supported in actionForm
    String forceDescStr = request.getParameter("forceDescending");
    String viewAs = getAndSetProperty(request, browseForm, "viewAs", request.getParameter("type"));
    String[] selected = (String[]) browseForm.get("selected");
    boolean startDateClip = "on".equals(startDateClipStr);
    if (StringUtils.isNotEmpty(submit)) {
        action = submit;
    }
    Date startDate = null;
    Date endDate = null;
    String formattedStartDate = null;
    if (StringUtils.isNotEmpty(startDateStr)) {
        try {
            startDate = DateUtils.parseAnyDate(startDateStr);
            if (startDate != null) {
                formattedStartDate = DateUtils.formatOptimal(startDate);
                log.debug("parsed start date to [" + formattedStartDate + "]");
                browseForm.set("insertedAfter", formattedStartDate);
                if (startDateClip) {
                    endDate = DateUtils.nextHigherValue(startDate);
                }
            } else {
                warn("could not parse date from [" + startDateStr + "]");
            }
        } catch (CalendarParserException e) {
            warn("could not parse date from [" + startDateStr + "]", e);
        }
    }
    if (StringUtils.isNotEmpty(endDateStr)) {
        try {
            endDate = DateUtils.parseAnyDate(endDateStr);
            if (startDate == null) {
                warn("could not parse date from [" + endDateStr + "]");
            }
        } catch (CalendarParserException e) {
            warn("could not parse date from [" + startDateStr + "]", e);
        }
    }
    ArrayList viewAsList = new ArrayList();
    viewAsList.add("html");
    viewAsList.add("text");
    browseForm.set("viewAsList", viewAsList);
    log.debug("selected [" + browseForm.get("selected") + "]");
    // ArrayList selected=(ArrayList)browseForm.get("selected");
    // for (int i=0; i<selected.size(); i++) {
    // log.debug("selected "+i+" = ["+selected.get(i));
    // }
    maxMessages = Integer.parseInt(maxMessagesStr);
    skipMessages = Integer.parseInt(skipMessagesStr);
    // commandIssuedBy containes information about the location the
    // command is sent from
    String commandIssuedBy = HttpUtils.getCommandIssuedBy(request);
    log.debug("storageType [" + storageType + "] action [" + action + "] submit [" + submit + "] adapterName [" + adapterName + "] receiverName [" + receiverName + "] pipeName [" + pipeName + "] issued by [" + commandIssuedBy + "]");
    Adapter adapter = (Adapter) ibisManager.getRegisteredAdapter(adapterName);
    IMessageBrowser mb;
    IListener listener = null;
    String logCount;
    if ("messagelog".equals(storageType)) {
        if (StringUtils.isNotEmpty(pipeName)) {
            MessageSendingPipe pipe = (MessageSendingPipe) adapter.getPipeLine().getPipe(pipeName);
            mb = pipe.getMessageLog();
        } else {
            ReceiverBase receiver = (ReceiverBase) adapter.getReceiverByName(receiverName);
            mb = receiver.getMessageLog();
        }
        // actions 'deletemessage' and 'resendmessage' not allowed for messageLog
        if ("export selected".equalsIgnoreCase(action)) {
            performAction(adapter, null, action, mb, messageId, selected, request, response);
        }
    } else {
        ReceiverBase receiver = (ReceiverBase) adapter.getReceiverByName(receiverName);
        if (receiver == null) {
            error("cannot find Receiver [" + receiverName + "]", null);
            return null;
        }
        mb = receiver.getErrorStorage();
        if (performAction(adapter, receiver, action, mb, messageId, selected, request, response))
            return null;
        listener = receiver.getListener();
    }
    try {
        logCount = "(" + ((ITransactionalStorage) mb).getMessageCount() + ")";
    } catch (Exception e) {
        log.warn(e);
        logCount = "(?)";
    }
    try {
        if ("showmessage".equalsIgnoreCase(action)) {
            Object rawmsg = mb.browseMessage(messageId);
            String msg = null;
            if (listener != null) {
                msg = listener.getStringFromRawMessage(rawmsg, null);
            } else {
                msg = (String) rawmsg;
            }
            if (StringUtils.isEmpty(msg)) {
                msg = "<no message found>";
            }
            String type = request.getParameter("type");
            if (StringUtils.isEmpty(type)) {
                type = viewAs;
            }
            FileViewerServlet.showReaderContents(new StringReader(msg), "msg" + messageId, type, response, "message [" + messageId + "]");
            return null;
        } else {
            IMessageBrowsingIterator mbi = mb.getIterator(startDate, endDate, "true".equals(forceDescStr));
            try {
                XmlBuilder messages = new XmlBuilder("messages");
                messages.addAttribute("storageType", storageType);
                messages.addAttribute("action", action);
                messages.addAttribute("adapterName", XmlUtils.encodeChars(adapterName));
                if ("messagelog".equals(storageType) && StringUtils.isNotEmpty(pipeName)) {
                    messages.addAttribute("object", "pipe [" + XmlUtils.encodeChars(pipeName) + "] of adapter [" + XmlUtils.encodeChars(adapterName) + "] " + logCount);
                    messages.addAttribute("pipeName", XmlUtils.encodeChars(pipeName));
                } else {
                    messages.addAttribute("object", "receiver [" + XmlUtils.encodeChars(receiverName) + "] of adapter [" + XmlUtils.encodeChars(adapterName) + "] " + logCount);
                    messages.addAttribute("receiverName", XmlUtils.encodeChars(receiverName));
                }
                int messageCount;
                for (messageCount = 0; mbi.hasNext(); ) {
                    IMessageBrowsingIteratorItem iterItem = mbi.next();
                    try {
                        String cType = iterItem.getType();
                        String cHost = iterItem.getHost();
                        String cId = iterItem.getId();
                        String cMessageId = iterItem.getOriginalId();
                        String cCorrelationId = iterItem.getCorrelationId();
                        String comment = iterItem.getCommentString();
                        Date insertDate = iterItem.getInsertDate();
                        String cLabel = iterItem.getLabel();
                        if (StringUtils.isNotEmpty(typeMask) && !cType.startsWith(typeMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(hostMask) && !cHost.startsWith(hostMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(currentIdMask) && !cId.startsWith(currentIdMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(messageIdMask) && !cMessageId.startsWith(messageIdMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(correlationIdMask) && !cCorrelationId.startsWith(correlationIdMask)) {
                            continue;
                        }
                        if (startDate != null && insertDate != null) {
                            if (insertDate.before(startDate)) {
                                continue;
                            }
                            if (startDateClip) {
                                String formattedInsertDate = DateUtils.formatOptimal(insertDate);
                                if (!formattedInsertDate.startsWith(formattedStartDate)) {
                                    continue;
                                }
                            }
                        }
                        if (StringUtils.isNotEmpty(commentMask) && (StringUtils.isEmpty(comment) || comment.indexOf(commentMask) < 0)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(messageTextMask)) {
                            Object rawmsg = mb.browseMessage(cId);
                            String msg = null;
                            if (listener != null) {
                                msg = listener.getStringFromRawMessage(rawmsg, new HashMap());
                            } else {
                                msg = (String) rawmsg;
                            }
                            if (msg == null || msg.indexOf(messageTextMask) < 0) {
                                continue;
                            }
                        }
                        if (StringUtils.isNotEmpty(labelMask) && (StringUtils.isEmpty(cLabel) || !cLabel.startsWith(labelMask))) {
                            continue;
                        }
                        messageCount++;
                        if (messageCount > skipMessages) {
                            XmlBuilder message = new XmlBuilder("message");
                            message.addAttribute("id", cId);
                            message.addAttribute("pos", Integer.toString(messageCount));
                            message.addAttribute("originalId", cMessageId);
                            message.addAttribute("correlationId", cCorrelationId);
                            message.addAttribute("type", cType);
                            message.addAttribute("host", cHost);
                            message.addAttribute("insertDate", DateUtils.format(insertDate, DateUtils.FORMAT_FULL_GENERIC));
                            if (iterItem.getExpiryDate() != null) {
                                message.addAttribute("expiryDate", DateUtils.format(iterItem.getExpiryDate(), DateUtils.FORMAT_FULL_GENERIC));
                            }
                            message.addAttribute("comment", XmlUtils.encodeChars(iterItem.getCommentString()));
                            message.addAttribute("label", cLabel);
                            messages.addSubElement(message);
                        }
                        if (getMaxMessages() > 0 && messageCount >= (getMaxMessages() + skipMessages)) {
                            log.warn("stopped iterating messages after [" + messageCount + "]: limit reached");
                            break;
                        }
                    } finally {
                        iterItem.release();
                    }
                }
                messages.addAttribute("messageCount", Integer.toString(messageCount - skipMessages));
                request.setAttribute("messages", messages.toXML());
            } finally {
                mbi.close();
            }
        }
    } catch (Throwable e) {
        error("Caught Exception", e);
        throw new ServletException(e);
    }
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
    }
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) DynaActionForm(org.apache.struts.action.DynaActionForm) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) HashMap(java.util.HashMap) IMessageBrowsingIteratorItem(nl.nn.adapterframework.core.IMessageBrowsingIteratorItem) IMessageBrowser(nl.nn.adapterframework.core.IMessageBrowser) IListener(nl.nn.adapterframework.core.IListener) ArrayList(java.util.ArrayList) Adapter(nl.nn.adapterframework.core.Adapter) IMessageBrowsingIterator(nl.nn.adapterframework.core.IMessageBrowsingIterator) Date(java.util.Date) ServletException(javax.servlet.ServletException) CalendarParserException(nl.nn.adapterframework.util.CalendarParserException) IOException(java.io.IOException) CalendarParserException(nl.nn.adapterframework.util.CalendarParserException) ServletException(javax.servlet.ServletException) StringReader(java.io.StringReader) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Aggregations

DynaActionForm (org.apache.struts.action.DynaActionForm)20 ActionForm (org.apache.struts.action.ActionForm)8 ActionMapping (org.apache.struts.action.ActionMapping)6 IOException (java.io.IOException)5 ServletException (javax.servlet.ServletException)5 ActionForward (org.apache.struts.action.ActionForward)4 ArrayList (java.util.ArrayList)3 Cookie (javax.servlet.http.Cookie)3 StringTagger (nl.nn.adapterframework.util.StringTagger)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 IbisAppenderWrapper (nl.nn.adapterframework.extensions.log4j.IbisAppenderWrapper)2 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)2 Appender (org.apache.log4j.Appender)2 Logger (org.apache.log4j.Logger)2 MockPrincipal (org.apache.struts.mock.MockPrincipal)2 FormFile (org.apache.struts.upload.FormFile)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 PrintWriter (java.io.PrintWriter)1