随笔-6  评论-1  文章-0  trackbacks-0
  2008年4月29日

resion:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>defaultroot</display-name>
    <servlet servlet-name="resin-jsp"
           servlet-class="com.caucho.server.security.FormLoginServlet">
  </servlet>

  <servlet servlet-name="resin-jspx"
           servlet-class="com.caucho.server.security.FormLoginServlet">
  </servlet>

  <servlet servlet-name="resin-xtp"
           servlet-class="com.caucho.server.security.FormLoginServlet"/>

  <servlet-mapping url-pattern="*.jsp" servlet-name="resin-jsp"/>
  <servlet-mapping url-pattern="*.jspx" servlet-name="resin-jspx"/>
  <servlet-mapping url-pattern="*.xtp" servlet-name="resin-xtp"/>
  <error-page>
     <error-code>500</error-code>
     <location>/500.htm</location>
  </error-page>
</web-app>

tomcat下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>defaultroot</display-name>
    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class></servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>
    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

    <!-- The mapping for the SSI servlet -->
</web-app>

posted @ 2008-05-26 09:23 天堂有路 阅读(636) | 评论 (0)编辑 收藏
linux环境下截取某个IP某个端口发的包
tcpdump -w 002.txt  -s0 host 192.168.10.1and port 2222

查看目录下有多少个文件
find   ./   -type   f   |   wc   -l

posted @ 2008-04-29 15:39 天堂有路 阅读(224) | 评论 (0)编辑 收藏
URL url = new URL("提交的URL");
 HttpURLConnection connection = (HttpURLConnection) url.openConnection();
 try
 {
  connection.setDoInput(true);
  connection.setDoOutput(true);
  {
   // 提交的内容
   byte[] requsetContent = new byte[1024];
   connection.setRequestProperty("Content-Length", Integer.toString(requsetContent.length));
   OutputStream outputStream = connection.getOutputStream();
   try
   {
    // 向外输入流
    outputStream.write(requsetContent);
    outputStream.flush();
   }
   catch (Exception ex)
   {
    throw ex;
   }
   finally
   {
    outputStream.close();
   }
  }
  // 获取HTTP相应请求
  int responseCode = connection.getResponseCode();
  String responseMessage = connection.getResponseMessage();
  {
   ByteArrayOutputStream baos = new ByteArrayOutputStream(1024 * 64);
   // 得到返回流
   InputStream inputStream = connection.getInputStream();
   try
   {
    byte[] buf = new byte[1024 * 64];
    int n;
    while ((n = inputStream.read(buf)) >= 0)
    {
     baos.write(buf, 0, n);
    }
   }
   catch (Exception ex)
   {
    ex.printStackTrace();
   }
   finally
   {
    inputStream.close();
   }
   // 获取包的内容
   byte[] responseContent = baos.toByteArray();
  }
 }
 catch (Exception ex)
 {
  throw ex;
 }
 finally
 {
  connection.disconnect();
 }
posted @ 2008-04-29 15:32 天堂有路 阅读(840) | 评论 (0)编辑 收藏


package rece.test;

import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.WebServiceContext;
import com.sun.net.httpserver.HttpExchange;


@WebService(targetNamespace = "http://rece.test.com", serviceName = "WebServiceRece")
@SOAPBinding(style = SOAPBinding.Style.RPC)

public class WebServiceRece
{
 @Resource
 private WebServiceContext wsContext;

 @WebMethod
 public String sendZxdxSms(@WebParam(partName = "Username")String userName,
         @WebParam(partName = "Password")String passWord,
         @WebParam(partName = "Content")String content,
         @WebParam(partName = "FromTerminalId")String fromTerminalId,
         @WebParam(partName = "ToTerminalId")String toTerminalId
         )
 {  
  //获取提交请求的IP地址
  HttpExchange exchange  = (HttpExchange)wsContext.getMessageContext().get("com.sun.xml.internal.ws.http.exchange");
  String remortAddress = exchange.getRemoteAddress().getAddress().getHostAddress();
   //具体实现
  return WebServiceReceImpl.getInstance().send(userName, passWord, content, fromTerminalId, toTerminalId,remortAddress);
 }
}

在main方法中启动这个webservice服务:
Endpoint.publish("http://localhost:9898/test/send.jws", new WebServiceRece());

打开wsdl
http://localhost:9898/test/send.jws?wsdl

生成客户端
在命令行下运行wsimport –keep http://localhost:9898/test/send.jws?wsdl,即可在当前目录生成客户端,-keep表示保留源文件,如果没有-keep,则只生成class文件

posted @ 2008-04-29 14:52 天堂有路 阅读(1661) | 评论 (1)编辑 收藏

su - oracle
sqlplus /nolog
connect /as sysdba
startup

lsnrctl start

posted @ 2008-04-29 14:38 天堂有路 阅读(2335) | 评论 (0)编辑 收藏