Results 1 to 3 of 3

Thread: Need to execute some custom business logic for each http request.

  1. #1
    Join Date
    Oct 2015
    Posts
    12

    Default Need to execute some custom business logic for each http request.

    Hi Wowza Members,

    I want to create a module doing some business logic on each http request. I have wriiten the code below but I'm not getting the desired output.

    import java.io.*;

    import com.wowza.wms.http.*;
    import com.wowza.wms.logging.*;
    import com.wowza.wms.vhost.*;

    public class ExampleTest extends HTTProvider2Base {
    private static final WMSLogger log = WMSLoggerFactory
    .getLogger(ExampleTest.class);

    public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {

    log.info("Some Text" + req.getPath());
    log.debug("Some other text" + req.getPath());
    log.error("Some different text" + req.getPath());


    String helloStr = "Hello World!";
    String retStr = "<html><head><title>" + helloStr
    + "</title></head><body>" + helloStr + "</body></html>";

    try {
    OutputStream out = resp.getOutputStream();
    byte[] outBytes = retStr.getBytes();
    out.write(outBytes);
    } catch (Exception e) {
    log.error("ExampleTest: " + e.toString());
    }

    }

    }


    I have mentioned the fully qualified name of the class in vHost.xml

    <HTTPProvider>
    <BaseClass>com.wowza.wms.example.module.ExampleTest</BaseClass>
    <RequestFilters>*</RequestFilters>
    <AuthenticationMethod>none</AuthenticationMethod>
    </HTTPProvider>

    After restarting the server i tried to call many http requests but I couldn't get the desired result.

    Kindly provide some assistance to achieve the same

  2. #2

    Default

    Are you getting any response at all?
    Can you post you full HostPortList from the VHost.xml file?

  3. Default

    Try using eg. WMSLoggerFactory.getLogger(null).info("Some Text" + req.getPath());

Similar Threads

  1. Generate unique url for each request
    By gopy29 in forum General Forum
    Replies: 1
    Last Post: 03-06-2015, 03:55 AM
  2. Execute FFMPEG commands when stream published
    By hussanchoudhry in forum General Forum
    Replies: 3
    Last Post: 11-27-2014, 08:18 AM
  3. Сomplicated business logic and balancing
    By Ramil.A in forum General Forum
    Replies: 8
    Last Post: 09-26-2012, 05:05 AM
  4. How to need configure wowza that I could use some inputs and stream some multicasts?
    By hafizradio in forum Live Streaming and Encoder Discussion
    Replies: 1
    Last Post: 06-06-2012, 09:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •