6413f550 by Ean Schuessler

Rough in basic structure.

1 parent a594e64b
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project name="comet-messenger" default="jar" basedir=".">
<first id="possible.ofbiz.home.common.xml">
<resources>
<fileset dir="..">
<include name="ofbiz/common.xml"/>
</fileset>
<fileset dir="/">
<include name="srv/ofbiz-upstream/common.xml"/>
<include name="opt/ofbiz-upstream/common.xml"/>
<include name="job/ofbiz-upstream/common.xml"/>
</fileset>
</resources>
</first>
<dirname property="possible.ofbiz.home.dir" file="${toString:possible.ofbiz.home.common.xml}"/>
<property name="ofbiz.home.dir" value="${possible.ofbiz.home.dir}"/>
<import file="${ofbiz.home.dir}/common.xml"/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<property name="desc" value="comet-messenger"/>
<property name="name" value="comet-messenger"/>
<path id="local.class.path">
<!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
<fileset dir="${ofbiz.home.dir}/framework/webapp/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/webapp/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/commons" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/j2eespecs" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/security/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/service/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/service/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/minilang/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/common/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/webapp/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/party/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/product/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/marketing/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/order/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/accounting/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/securityext/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/start/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/catalina/lib" includes="*.jar"/>
</path>
</project>
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
<!-- ========================================================= -->
<title>Entity of an Open For Business Project Component</title>
<description>None</description>
<copyright>Copyright 2001-2009 The Apache Software Foundation</copyright>
<author>None</author>
<version>1.0</version>
</entitymodel>
<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component name="comet-messenger"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
<classpath type="jar" location="lib/*"/>
<classpath type="jar" location="build/lib/*"/>
</ofbiz-component>
<?xml version="1.0" encoding="UTF-8"?>
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
<description>DriverUp</description>
<vendor>DriverUp</vendor>
<version>1.0</version>
</services>
package com.brainfood.ofbiz;
import org.apache.catalina.comet.CometEvent;
import org.apache.catalina.comet.CometProcessor;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
public class CometMessengerServlet extends HttpServlet implements CometProcessor {
private static final Integer TIMEOUT = 60 * 1000;
@Override
public void destroy() {
}
@Override
public void init() throws ServletException {
}
public void event(final CometEvent event) throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
request.setAttribute("org.apache.tomcat.comet.timeout", TIMEOUT);
log("Begin for session: " + request.getSession(true).getId());
} else if (event.getEventType() == CometEvent.EventType.ERROR) {
log("Error for session: " + request.getSession(true).getId());
event.close();
} else if (event.getEventType() == CometEvent.EventType.END) {
log("End for session: " + request.getSession(true).getId());
event.close();
} else if (event.getEventType() == CometEvent.EventType.READ) {
throw new UnsupportedOperationException("This servlet does not accept data");
}
}
}