webservice本地发布错误bug
This commit is contained in:
parent
d93494a9fc
commit
5d151d4d8a
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package com.ifish.config;
|
|
||||||
|
|
||||||
import com.sun.xml.ws.transport.http.servlet.WSServletContextListener;
|
|
||||||
import javax.servlet.ServletContextEvent;
|
|
||||||
import javax.servlet.ServletContextListener;
|
|
||||||
import javax.servlet.annotation.WebListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Administrator
|
|
||||||
*/
|
|
||||||
public class MyWSServletContextListener implements ServletContextListener {
|
|
||||||
|
|
||||||
private static WSServletContextListener wsscl = null;
|
|
||||||
|
|
||||||
static {
|
|
||||||
wsscl = new WSServletContextListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
|
||||||
wsscl.contextInitialized(sce);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void contextDestroyed(ServletContextEvent sce) {
|
|
||||||
wsscl.contextDestroyed(sce);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -108,7 +108,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void messageSent(IoSession session, Object message) {
|
public void messageSent(IoSession session, Object message) {
|
||||||
//System.out.println("messageSent");
|
System.out.println("messageSent");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -126,7 +126,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sessionOpened(IoSession session) throws Exception {
|
public void sessionOpened(IoSession session) throws Exception {
|
||||||
//log.info("session open!!!");
|
log.info("session open!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package com.ifish.socket.config;
|
package com.ifish.socket.config;
|
||||||
|
|
||||||
import com.ifish.helper.UserHelperI;
|
|
||||||
import com.ifish.socket.model.JobGroup;
|
import com.ifish.socket.model.JobGroup;
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import org.quartz.JobBuilder;
|
import org.quartz.JobBuilder;
|
||||||
import org.quartz.JobDetail;
|
import org.quartz.JobDetail;
|
||||||
import org.quartz.JobKey;
|
import org.quartz.JobKey;
|
||||||
|
|
@ -22,7 +19,6 @@ import org.quartz.impl.StdSchedulerFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import org.apache.mina.core.session.IoSession;
|
||||||
*/
|
*/
|
||||||
@WebService
|
@WebService
|
||||||
public class MyService {
|
public class MyService {
|
||||||
|
|
||||||
//查询设备是否在线
|
//查询设备是否在线
|
||||||
|
|
||||||
public boolean deviceIsOnline(String macAddress) {
|
public boolean deviceIsOnline(String macAddress) {
|
||||||
if (macAddress != null && macAddress.length() > 0) {
|
if (macAddress != null && macAddress.length() > 0) {
|
||||||
IoSession session = SomeServer.sessions_cz.get(macAddress);
|
IoSession session = SomeServer.sessions_cz.get(macAddress);
|
||||||
|
|
@ -51,5 +51,4 @@ public class MyService {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,9 @@ import javax.xml.ws.Endpoint;
|
||||||
*/
|
*/
|
||||||
public class ServiceBean {
|
public class ServiceBean {
|
||||||
|
|
||||||
|
private static boolean push = false;
|
||||||
|
|
||||||
public ServiceBean() {
|
public ServiceBean() {
|
||||||
|
Endpoint.publish("http://localhost:9001/Service/webService", new MyService());
|
||||||
}
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
try {
|
|
||||||
Endpoint.publish("http://localhost:9001/Service/webService", new MyService());
|
|
||||||
System.out.println("MyService发布成功!");
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||||
|
|
||||||
<!-- webService -->
|
<!-- webService -->
|
||||||
<bean id="serviceBean" class="com.ifish.socket.webService.ServiceBean" init-method="init"></bean>
|
<bean id="serviceBean" class="com.ifish.socket.webService.ServiceBean"></bean>
|
||||||
<!-- 消息处理类 -->
|
<!-- 消息处理类 -->
|
||||||
<bean id="someServer" class="com.ifish.socket.config.SomeServer"></bean>
|
<bean id="someServer" class="com.ifish.socket.config.SomeServer"></bean>
|
||||||
<!-- 实现job中注入bean -->
|
<!-- 实现job中注入bean -->
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- SessionConfig 通过工厂方法注入 -->
|
<!--SessionConfig 通过工厂方法注入-->
|
||||||
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig">
|
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig">
|
||||||
<property name="bothIdleTime" value="60" />
|
<property name="bothIdleTime" value="60" />
|
||||||
<property name="minReadBufferSize" value="512" />
|
<property name="minReadBufferSize" value="512" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||||
|
version="3.1">
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
</web-app>
|
||||||
Loading…
Reference in New Issue