@Override
  public Map<String, List<CodeTemplate>> getReferenceItems() {
    Map<String, List<CodeTemplate>> referenceItems = new HashMap<String, List<CodeTemplate>>();

    List<CodeTemplate> httpListenerFunctionsList = new ArrayList<CodeTemplate>();
    httpListenerFunctionsList.add(
        new CodeTemplate(
            "Get HTTP Request Method",
            "Retrieves the method (e.g. GET, POST) from an incoming HTTP request.",
            "sourceMap.get('method')",
            CodeSnippetType.CODE,
            ContextType.MESSAGE_CONTEXT.getContext()));
    httpListenerFunctionsList.add(
        new CodeTemplate(
            "Get HTTP Request Context Path",
            "Retrieves the context path from an incoming HTTP request.",
            "sourceMap.get('contextPath')",
            CodeSnippetType.CODE,
            ContextType.MESSAGE_CONTEXT.getContext()));
    httpListenerFunctionsList.add(
        new CodeTemplate(
            "Get HTTP Request Header",
            "Retrieves a header value from an incoming HTTP request.",
            "sourceMap.get('headers').get('Header-Name')",
            CodeSnippetType.CODE,
            ContextType.MESSAGE_CONTEXT.getContext()));
    httpListenerFunctionsList.add(
        new CodeTemplate(
            "Get HTTP Request Parameter",
            "Retrieves a query/form parameter from an incoming HTTP request. If multiple values exist for the parameter, an array will be returned.",
            "sourceMap.get('parameters').get('parameterName')",
            CodeSnippetType.CODE,
            ContextType.MESSAGE_CONTEXT.getContext()));
    httpListenerFunctionsList.add(
        new CodeTemplate(
            "Convert HTTP Payload to XML",
            "Serializes an HTTP request body into XML. Multipart requests will also automatically be parsed into separate XML nodes. The body may be passed in as a string or input stream.",
            "HTTPUtil.httpBodyToXml(httpBody, contentType)",
            CodeSnippetType.CODE,
            ContextType.GLOBAL_CONTEXT.getContext()));
    referenceItems.put("HTTP Listener Functions", httpListenerFunctionsList);

    return referenceItems;
  }
Ejemplo n.º 2
0
  // <editor-fold defaultstate="collapsed" desc=" Generated Code
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    tabPanel = new javax.swing.JTabbedPane();
    variableTab = new javax.swing.JPanel();
    variableSplitPane = new javax.swing.JSplitPane();
    functionList = new FunctionList(ContextType.MESSAGE_CONTEXT.getContext());
    variableListScrollPane = new javax.swing.JScrollPane();
    variableTable = new com.mirth.connect.client.ui.panels.reference.VariableReferenceTable();
    treeTab = new javax.swing.JPanel();
    messageTreePanel = new com.mirth.connect.client.ui.editors.MessageTreePanel();
    messageTab = new javax.swing.JPanel();
    messageTemplatePanel = new MessageTemplatePanel(parent);

    variableTab.setBackground(new java.awt.Color(255, 255, 255));

    variableSplitPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    variableSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

    functionList.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    variableSplitPane.setLeftComponent(functionList);

    variableListScrollPane.setViewportView(variableTable);

    variableSplitPane.setRightComponent(variableListScrollPane);

    javax.swing.GroupLayout variableTabLayout = new javax.swing.GroupLayout(variableTab);
    variableTab.setLayout(variableTabLayout);
    variableTabLayout.setHorizontalGroup(
        variableTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                variableSplitPane,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                257,
                Short.MAX_VALUE));
    variableTabLayout.setVerticalGroup(
        variableTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                variableTabLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        variableSplitPane,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        518,
                        Short.MAX_VALUE)));

    tabPanel.addTab("Reference", variableTab);

    treeTab.setBackground(new java.awt.Color(255, 255, 255));

    javax.swing.GroupLayout treeTabLayout = new javax.swing.GroupLayout(treeTab);
    treeTab.setLayout(treeTabLayout);
    treeTabLayout.setHorizontalGroup(
        treeTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                messageTreePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE));
    treeTabLayout.setVerticalGroup(
        treeTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                messageTreePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE));

    tabPanel.addTab("Message Trees", treeTab);

    messageTab.setBackground(new java.awt.Color(255, 255, 255));

    javax.swing.GroupLayout messageTabLayout = new javax.swing.GroupLayout(messageTab);
    messageTab.setLayout(messageTabLayout);
    messageTabLayout.setHorizontalGroup(
        messageTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                messageTemplatePanel,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                257,
                Short.MAX_VALUE));
    messageTabLayout.setVerticalGroup(
        messageTabLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                messageTemplatePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE));

    tabPanel.addTab("Message Templates", messageTab);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE));
  } // </editor-fold>//GEN-END:initComponents