【Android】Android下的Jetty
【Android】Android上的Jetty:L 今天看到一个比较变态的。。。jetty port到Android上面了:http://code.google.c
【Android】Android上的Jetty
:L 今天看到一个比较变态的。。。jetty port到Android上面了:
http://code.google.com/p/i-jetty/
就是说可以在你手机上运行Jetty,提供servlet,comet push,然后你就有个手机上的local server了。
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.mortbay.ijetty"> <application android:icon="@drawable/icon"> <activity android:label="@string/app_name"> <intent-filter> <action android:value="android.intent.action.MAIN" /> <category android:value="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
看起来很变态啊!不知道具体如何用法,大家讨论讨论! private void startJetty() throws Exception { //TODO - get ports and types of connector from SharedPrefs? server = new Server(); Connector connector=new SelectChannelConnector(); connector.setPort(8080); server.setConnectors(new Connector[]{connector}); //Deploy a servlet to serve on--phone information Context context = new Context(server, "/", Context.SESSIONS); InfoServlet infoServlet = new InfoServlet(); infoServlet.setContentResolver(getContentResolver()); context.addServlet(new ServletHolder(infoServlet), "/"); //context.addServlet(new ServletHolder(staticServlet), "/css/*"); //Bridge jetty logging to Android logging System.setProperty("org.mortbay.log.class","org.mortbay.log.AndroidLog"); org.mortbay.log.Log.setLog(new AndroidLog()); server.start(); } private void stopJetty() throws Exception { Log.i("Jetty", "Jetty stopping"); server.stop(); server.join(); server=null; }
感觉啥都没做,就是改了个首页的sevelet和换了一下default logging service.
大哥,详细说说。。。有兴趣ing~~~ 15 楼 steeven 2008-03-12 偶在P990上写过一个简单的FTPd, 嘿嘿。 16 楼 larryzou 2008-03-12 据说ibm已经把servlet这套放到了J2ME上。但是最后的结果是。。。项目死掉了 17 楼 差沙 2008-03-29 不知道大家还讨论这个不 其实jetty移植到android挺正常的 我吧lumaqq拿上去直接就能用 啥都没改就能发消息了
另外 iphone上面早就有webserver了 apache lighttpd php ruby python perl应有尽有
最开始感觉挺好玩 例如做个php网页发短信