Web Cam: Configuring

From CFTP

Jump to: navigation, search

This explains configuration for the latest Version 1.01


The plug-in is configured in the file conf/beans.xml located in your server's home directory.


File System Wrapper

Class name FileSystemWrapper

This class wraps around your existing file system.

<bean id="filesystem"
  class="com.coldcore.coloradoftp.plugin.webcam.FileSystemWrapper">
  <constructor-arg index="0" ref="originalFilesystem"/>
  <property name="interceptors">
    <bean class="java.util.HashSet">
      <constructor-arg index="0">
        <set>
          <ref bean="quickCamera"/>
          <ref bean="proCamera"/>
        </set>
      </constructor-arg>
    </bean>
  </property>
</bean>

Properties you may apply:


constructor

Your existing file system to wrap.


interceptors

Set of interceptors to execute upon uploads.


Upload Interceptor

Class name UploadInterceptor

This class executes an underlying TASK if the name of a user uploading a file matches its username property.

<bean id="quickCamera"
  class="com.coldcore.coloradoftp.plugin.webcam.UploadInterceptor">
  <property name="username" value="quickcam"/>
  <property name="task">
 
    <bean class="com.coldcore.coloradoftp.plugin.webcam.task.HttpSubmitTask">
    .........
    </bean>
 
  </property>
</bean>

Properties you may apply:


username

Name of a user whose file uploads must be intercepted.


task

Task to execute upon file uploads.


Http Submit Task

Class name HttpSubmitTask

This TASK submits a file to HTTP server using POST method. The resources section contains a link to a Servlet that accepts files supplied by this task, use it as an example when implementing your own.

<bean id="quickCamera"
  class="com.coldcore.coloradoftp.plugin.webcam.UploadInterceptor">
  .........
  <property name="task">
 
    <bean class="com.coldcore.coloradoftp.plugin.webcam.task.HttpSubmitTask">
      <property name="submitUrl" value="http://localhost/stream"/>
      <property name="fileParameterName" value="picture"/>
      <property name="parameters">
        <map>
          <entry key="channel" value="garden"/>
          <entry key="password" value="upload987"/>
        </map>
      </property>
    </bean>
 
  </property>
</bean>

Properties you may apply:


submitUrl

Uploaded files will be forwarder to this URL via HTTP POST method.


fileParameterName

The file data will be inserted into HTTP request body under this name.


parameters

Additional parameters to include into HTTP request. This is an optional element. It may be useful if you want to implement custom security mechanism (e.g. your JSP/Servlet checks included password parameter) or if you want to display more than one picture using the same JPS/Servlet (e.g. your JSP/Servlet holds many images based on the channel parameter). In this XML sample JSP/Servlet accepts a file only if the supplied password is correct and saves the file in its cache under the garden key. Other web cameras supply the same password but different channel name. You may supply any additional parameters your JSP/Servlet can handle.


queueSize

This is an optional element not displayed in the XML sample here. This is the size of an internal queue that contains files. Sending to a web server takes time and there is no guarantee that a web camera user will not start a new upload while the TASK is still busy sending off a file to a web server. This queue is used to keep files in memory so those can be forwarded to the web server in proper sequence one after another. Queue size prevents FTP server from running out of memory when uploads are happening very frequently and forwarding to the web server is too slow. That is how many files FTP server will hold in memory for every web camera user. The default value is 10, you may set 0 to disable the queue limit, but this is not recommended!



Return to Plug-in: Web Cam

Personal tools