com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Web Applications

This section provides the following information: 

          

Introduction to web applications

Web components are packaged in Web Application Archives (WAR), which are then deployed in the Application Server. Before creating the .war file, you need the class files and the web.xml file in the archive directory. The hierarchical directory structure of the web archive is as follows:

HellowWorld.war
    index.html
    *.jsp
    WEB-INF/
       web.xml
       lib/
       classes/
    META-INF/
    images/

For more information on WAR files, please refer to http://ant.apache.org/manual/Tasks/war.html

Enable SaaS mode for web applications

You can enable SaaS mode for your web applications by configuring the web.xml file relevant to each web application. Further, you can share the web application among multiple tenants from this configuration.

To enable SaaS mode for a web application:

  1. Open the web.xml file of your web application from the archive directory.
  2. The carbon.enable.saas parameter should be added to enable SaaS mode. The value you give for this parameter will depend on the use case. For example, consider that a tenant wants to share its web application with wso2.com, foo.com and bar.com. You can change the parameter value according to the use case as shown below.

    If all tenants can access this application, enter the following:

    <context-param>
    <param-name>carbon.enable.saas</param-name> 
    <param-value>*</param-value>
    </context-param>

    If all tenants except foo.com and bar.com can access this application, enter the following:

    <context-param>
    <param-name>carbon.enable.saas</param-name> 
    <param-value>*, !foo.com,!bar.com</param-value>
    </context-param>

    If only foo.com and bar.com (all users) can access this application, enter the following:

    <context-param> 
    <param-name>carbon.enable.saas</param-name> 
    <param-value>foo.com,bar.com</param-value>
    </context-param>

    If only Sam and admin in foo.com tenant and all users in bar.com tenant can access this application, enter the following: 

    <context-param>
    <param-name>carbon.enable.saas</param-name> 
    <param-value>foo.com;users=Sam,admin,bar.com</param-value>
    </context-param>

Enabling CORS for web applications

If required, you can enable CORS (cross origin resource sharing) for web applications by adding the CORS filter to the web.xml file as shown in the following example. 

<filter>
    <filter-name>CorsFilter</filter-name>
    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
    <init-param>
        <param-name>cors.allowed.origins</param-name>
        <param-value>*</param-value>
    </init-param>
    <init-param>
        <param-name>cors.allowed.methods</param-name>
        <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE,PATCH</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>CorsFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

The parameters used in this example are as follows:  

  • The cors.allowed.origins parameter is used to specify the web domains that should be allowed to share resources with the web application. The domain names should be specified as parameter values. If the parameter value is set to '*' as shown above, or if this parameter is not used at all, resource sharing will be allowed for all origins (all web domains). 
  • The cors.allowed.methods parameter is used to specify the type of requests for which CORS should be enabled. You can list the allowed methods as parameter values. 

Deploying web applications 

Web application deployment and management capability is provided by the following feature:

Name : WSO2 Carbon - Webapp Management Feature 
Identifier : org.wso2.carbon.webapp.mgt.feature.group

This feature is bundled in WSO2 Application Server by default. If the product you are using does have this feature by default, you can install it using the instructions provided in the Feature Management section. Once installed, the necessary menus will appear in the Management Console.

Follow the instructions below to upload a Web archive file to a Carbon Server.

  1. Log on to the product's management console and select "Web Applications” under “Applications” -> “Add” in the left pane.
  2. The "Upload Web Applications" window appears. Browse and select your Web archive file. Then click "Upload."

    For example,

    Tip
    Use the plus ‘+’ sign button to upload multiple Webapps at the same time. Click the minus sign to cancel an additional upload.

     

  3. If the file is uploaded successfully, a message appears prompting you to refresh the page. Click "OK."
  4. The .war file will be listed in the "Running Applications" page.

If the Web application is faulty, a "Faulty Web Application Groups" link will appear. You can click the link to view the errors. 

You can also manually place the .war containing all the required files into the <PRODUCT_HOME>/repository/deployment/server/webapps directory. These archive files can be deployed as Web applications.

Connecting to an application

WSO2 AS supports a variety of transports . Among these, the HTTP  and HTTPS  servlet transports are used by the applications hosted on AS to connect with other clients and applications. The receiver implementation for the HTTP and HTTPS transports are built into Carbon products, and the sender implementation comes from the Tomcat http connector, which is configured in the catalina-server.xml file (stored in the <PRODUCT_HOME>/repository/conf/tomcat/ folder).

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.