锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品第五页中文字幕,国产成人亚洲综合色影视,日本亚洲欧美色视频在线播放http://www.tkk7.com/yglwxl/zh-cnMon, 12 May 2025 02:40:47 GMTMon, 12 May 2025 02:40:47 GMT60Create Struts 2 Application in Eclipse : HTTP Status 500 http://www.tkk7.com/yglwxl/archive/2012/04/21/375434.html涔濆疂涔濆疂Fri, 20 Apr 2012 18:41:00 GMThttp://www.tkk7.com/yglwxl/archive/2012/04/21/375434.htmlhttp://www.tkk7.com/yglwxl/comments/375434.htmlhttp://www.tkk7.com/yglwxl/archive/2012/04/21/375434.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/375434.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/375434.htmlhttp://viralpatel.net/blogs/2009/12/tutorial-create-struts-2-application-eclipse-example.html 

problem:

HTTP Status 500 

java.lang.NullPointerException 	
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
resolve problem:
1. struts.xml should under src
2. in struts.xml:  
<action name="login" method="excute"
class="net.viralpatel.struts2.LoginAction">


涔濆疂 2012-04-21 02:41 鍙戣〃璇勮
]]>
How to check file properties through WMI command line (fw)http://www.tkk7.com/yglwxl/archive/2011/12/07/365818.html涔濆疂涔濆疂Wed, 07 Dec 2011 14:29:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/12/07/365818.htmlhttp://www.tkk7.com/yglwxl/comments/365818.htmlhttp://www.tkk7.com/yglwxl/archive/2011/12/07/365818.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/365818.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/365818.htmlHow to check file properties through WMI command line24.Sep.2009 | by Gusac | Filed in: Articles, Tutorials

With the lack of Graphical Interface on Windows 2008 Core server there comes a need of performing a lot of task through command line. One of which is checking file properties like file version, path, product verision etc. Luckily we have a command that makes this task simple. On a side note, We can also run the same command on other operating systems like Windows Xp, 2003, vista.

Here is the command:
wmic datafile where name='c:\\windows\\system32\\notepad.exe'

Click here to view the enlarged screenshot

Notice that we have used two backslashes \\ in the file path. Also, notice that the path is enclosed in the single quotes.
The output will be confusing to read in command prompt window. To read and understand it better, we can take the output in text format and read it in notepad.

While doing so, please do NOT wrap the text.
wmic datafile where name='c:\\windows\\system32\\notepad.exe' > out.txt

Click here to view the enlarged screenshot

The output will reveal the file properties like Hidden, Path, Drive, Version Caption, Access rights etc.

To get one particular property of a file we need to modify the command a little bit. We need to use the GET Alias injunction to the command mentioned above. Let's say we want to check the version for the file notepad.exe. The command that is used for this is:
wmic datafile where name='c:\\windows\\system32\\notepad.exe' get version

Similarily, there is a list of properties that can be fetched through this command line. They are:

Access Rights
Caption
Class Name
Compressed
Compression Method
Computer System Class Name
Computer System Name
Creation Date
Current File Open Count
Description
Drive
Eight Dot Three File Name
Encrypted
Encryption Method
File Extension
File Name
File System Class Name
File System Name
File Type
Hidden
Install Date
Last Accessed
Last Modified
Manufacturer
Name
Path
Readable
Should Be Archived
Size
Status
System File
Version
Writeable



涔濆疂 2011-12-07 22:29 鍙戣〃璇勮
]]>
Windows Authentication <windowsAuthentication>http://www.tkk7.com/yglwxl/archive/2011/09/16/358838.html涔濆疂涔濆疂Fri, 16 Sep 2011 13:46:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/09/16/358838.htmlhttp://www.tkk7.com/yglwxl/comments/358838.htmlhttp://www.tkk7.com/yglwxl/archive/2011/09/16/358838.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/358838.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/358838.htmlfrom http://www.iis.net/ConfigReference/system.webServer/security/authentication/windowsAuthentication

Overview

The <windowsAuthentication> element defines configuration settings for the Internet Information Services (IIS) 7 Windows authentication module. You can use Windows authentication when your IIS 7 server runs on a corporate network that is using Microsoft Active Directory service domain identities or other Windows accounts to identify users. Because of this, you can use Windows authentication whether or not your server is a member of an Active Directory domain.

Windows authentication (formerly named NTLM, and also referred to as Windows NT Challenge/Response authentication) is a secure form of authentication because the user name and password are hashed before being sent across the network. When you enable Windows authentication, the client browser sends a strongly hashed version of the password in a cryptographic exchange with your Web server.

Windows authentication supports two authentication protocols, Kerberos and NTLM, which are defined in the <providers> element. When you install and enable Windows authentication on IIS 7, the default protocol is Kerberos. The <windowsAuthentication> element can also contain a useKernelMode attribute that configures whether to use the kernel mode authentication feature that is new to Windows Server 2008.

Windows authentication is best suited for an intranet environment for the following reasons:

  • Client computers and Web servers are in the same domain.
  • Administrators can make sure that every client browser is Internet Explorer 2.0 or later.
  • HTTP proxy connections, which are not supported by NTLM, are not required.
  • Kerberos version 5 requires a connection to Active Directory, which is not feasible in an Internet environment.

New in IIS 7.5

The <extendedProtection> element was introduced in IIS 7.5, which allows you to configure the settings for the new extended protection features that have been integrated into Windows authentication.

Compatibility

Version Notes
IIS 7.5 The <extendedProtection> element was added in IIS 7.5.
IIS 7.0 The <windowsAuthentication> element was introduced in IIS 7.0.
IIS 6.0 The <windowsAuthentication> element replaces portions of the IIS 6.0 AuthType and AuthFlags metabase properties.

Setup

The default installation of IIS 7 does not include the Windows authentication role service. To use Windows authentication on IIS, you must install the role service, disable Anonymous authentication for your Web site or application, and then enable Windows authentication for the site or application.

Note: After you install the role service, IIS 7 commits the following configuration settings to the ApplicationHost.config file.

<windowsAuthentication enabled="false" />

Windows Server 2008 or Windows Server 2008 R2

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
  4. On the Select Role Services page of the Add Role Services Wizard, select Windows Authentication, and then click Next.
  5. On the Confirm Installation Selections page, click Install.
  6. On the Results page, click Close.

Windows Vista or Windows 7

  1. On the taskbar, click Start, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.
  3. Expand Internet Information Services, then World Wide Web Services, then Security.
  4. Select Windows Authentication, and then click OK.

How To

How to enable Windows authentication for a Web site, Web application, or Web service

  1. Open Internet Information Services (IIS) Manager:
    • If you are using Windows Server 2008 or Windows Server 2008 R2:
      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:
      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, expand the server name, expand Sites, and then the site, application, or Web service for which you want to enable Windows authentication.
  3. Scroll to the Security section in the Home pane, and then double-click Authentication.
  4. In the Authentication pane, select Windows Authentication, and then click Enable in the Actions pane.

How to enable Extended Protection for Windows authentication

  1. Open Internet Information Services (IIS) Manager:
    • If you are using Windows Server 2008 or Windows Server 2008 R2:
      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:
      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, expand the server name, expand Sites, and then the site, application, or Web service for which you want to enable Extended Protection for Windows authentication.
  3. Scroll to the Security section in the Home pane, and then double-click Authentication.
  4. In the Authentication pane, select Windows Authentication.
  5. Click Enable in the Actions pane.
  6. Click Advanced Settings in the Actions pane.
  7. When the Advanced Settings dialog box appears, select one of the following options in the Extended Protection drop-down menu:
    • Select Accept if you want to enable extended protection while providing down-level support for clients that do not support extended protection.
    • Select Required if you want to enable extended protection without providing down-level support.
  8. Click OK to close the Advanced Settings dialog box.

Configuration

The <windowsAuthentication> element is configurable at the site, application, or virtual directory level in the ApplicationHost.config file.

Attributes

Attribute Description
authPersistNonNTLM Optional Boolean attribute.

Specifies whether IIS automatically reauthenticates every non-NTLM (for example, Kerberos) request, even those on the same connection. False enables multiple authentications for the same connections.

Note: A setting of true means that the client will be authenticated only once on the same connection. IIS will cache a token or ticket on the server for a TCP session that stays established.

The default is false.
authPersistSingleRequest Optional Boolean attribute.

Setting this flag to true specifies that authentication persists only for a single request on a connection. IIS resets the authentication at the end of each request, and forces reauthentication on the next request of the session.

The default value is false.
enabled Required Boolean attribute.

Specifies whether Windows authentication is enabled.

The default value is false.
useKernelMode Optional Boolean attribute.

Specifies whether Windows authentication is done in kernel mode. True specifies that Windows authentication uses kernel mode.

Kernel-mode authentication may improve authentication performance and prevent authentication problems with application pools that are configured to use a custom identity.

As a best practice, do not disable this setting if you use Kerberos authentication and have a custom identity on the application pool.

The default is true.

Child Elements

Element Description
extendedProtection Optional element.

Specifies extended protection options for Windows authentication.

Note: This element was added in IIS 7.5.
providers Optional element.

Specifies security support providers used for Windows authentication.

Configuration Sample

The following default <windowsAuthentication> element is configured at the root ApplicationHost.config file in IIS 7.0, and disables Windows authentication by default. It also defines the two Windows authentication providers for IIS 7.0.

<windowsAuthentication enabled="false">
   <providers>
      <add value="Negotiate" />
      <add value="NTLM" />
   </providers>
</windowsAuthentication>

The following example enables Windows authentication and disables Anonymous authentication for a Web site named Contoso.

<location path="Contoso">
   <system.webServer>
      <security>
         <authentication>
            <anonymousAuthentication enabled="false" />
            <windowsAuthentication enabled="true" />
         </authentication>
      </security>
   </system.webServer>
</location>

Sample Code

The following examples disable Anonymous authentication for a site named Contoso, then enable Windows authentication for the site.

AppCmd.exe

appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"False" /commit:apphost

appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost

Note: You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample {

   private static void Main() {

      using(ServerManager serverManager = new ServerManager()) { 
         Configuration config = serverManager.GetApplicationHostConfiguration();

         ConfigurationSection anonymousAuthenticationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso");
         anonymousAuthenticationSection["enabled"] = false;

         ConfigurationSection windowsAuthenticationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Contoso");
         windowsAuthenticationSection["enabled"] = true;

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample
   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration

      Dim anonymousAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso")
      anonymousAuthenticationSection("enabled") = False

      Dim windowsAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Contoso")
      windowsAuthenticationSection("enabled") = True

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso");
anonymousAuthenticationSection.Properties.Item("enabled").Value = false;

var windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso");
windowsAuthenticationSection.Properties.Item("enabled").Value = true;

adminManager.CommitChanges();

VBScript

Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso")
anonymousAuthenticationSection.Properties.Item("enabled").Value = False

Set windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso")
windowsAuthenticationSection.Properties.Item("enabled").Value = True

adminManager.CommitChanges()


涔濆疂 2011-09-16 21:46 鍙戣〃璇勮
]]>
How To Determine if Your Computer Is 32-Bit or 64-Bit(forward)http://www.tkk7.com/yglwxl/archive/2011/09/16/358751.html涔濆疂涔濆疂Thu, 15 Sep 2011 19:34:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/09/16/358751.htmlhttp://www.tkk7.com/yglwxl/comments/358751.htmlhttp://www.tkk7.com/yglwxl/archive/2011/09/16/358751.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/358751.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/358751.htmlhow to check window version

run: Winver


Here's How:
  1. Open the System Information

    Open the Start menu, and click on Programs -> Accessories -> System Tools -> System Information

     

  2. Look in the System Summary

    The System Information tool will display detailed information about your Windows operating system. Once opened it will show the "System Summary" – it’s an overview of your computer and operating system.

  3. Look for the System Type Item

    On the right hand side of the window you will see a list of items. Look for the item called "System Type".

    The value of this item will tell you whether your computer is 32-bit or 64-bit:

    • x86-based PC: It’s a 32-bit computer.
    • x64-based PC: It’s a 64-bit computer.

     



涔濆疂 2011-09-16 03:34 鍙戣〃璇勮
]]>
ContentProvider鍒嗘瀽http://www.tkk7.com/yglwxl/archive/2011/02/18/344618.html涔濆疂涔濆疂Fri, 18 Feb 2011 06:51:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/02/18/344618.htmlhttp://www.tkk7.com/yglwxl/comments/344618.htmlhttp://www.tkk7.com/yglwxl/archive/2011/02/18/344618.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/344618.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/344618.html闃呰鍏ㄦ枃

涔濆疂 2011-02-18 14:51 鍙戣〃璇勮
]]>
GestureDetector鎵嬪娍璇嗗埆綾?(杞?http://www.tkk7.com/yglwxl/archive/2011/02/16/344449.html涔濆疂涔濆疂Wed, 16 Feb 2011 07:03:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/02/16/344449.htmlhttp://www.tkk7.com/yglwxl/comments/344449.htmlhttp://www.tkk7.com/yglwxl/archive/2011/02/16/344449.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/344449.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/344449.htmlView鏄湪onTouchEvent(MotionEvent event)閲屽鐢ㄦ埛鐨勫姩浣滃仛浜嗕竴瀹氱殑鍒嗘瀽錛屼粠鑰岄氱煡鎴戜滑鏄彂鐢熶簡鐐瑰嚮榪樻槸闀挎寜絳変簨浠躲?/span>

鎴戜滑闇瑕佸垱寤轟竴涓?/span>GestureDetector鐨勫璞★紝浼犲叆listener瀵硅薄錛寁iew鎺ユ敹鍒扮殑onTouchEvent涓皢event浼犵粰GestureDetector榪涜鍒嗘瀽錛?/span>listener浼氬洖璋冪粰鎴戜滑鐩稿簲鐨勫姩浣溿傚叾涓?/span>GestureDetector.SimpleOnGestureListener錛?/span>Framework甯垜浠畝鍖栦簡錛夋槸瀹炵幇浜嗕笂闈㈡彁鍒扮殑OnGestureListener鍜?/span>OnDoubleTapListener涓や釜鎺ュ彛鐨勭被錛屾垜浠彧闇瑕佺戶鎵垮畠騫墮噸鍐欏叾涓垜浠叧蹇冪殑鍥炶皟鍗沖彲銆?/span>

錛岄偅涔堬紝榪欎釜綾誨浣曚嬌鐢ㄥ憿錛熶互涓嬫槸浣跨敤璇ョ被鐨勪竴涓寖渚嬶細

private GestureDetector mGestureDetector;

@Override

public void onCreate(Bundle savedInstanceState) {


  super.onCreate(savedInstanceState);


  mGestureDetector = new GestureDetector(this, new MyGestureListener());


}


@Override

public boolean onTouchEvent(MotionEvent event) {

 return mGestureDetector.onTouchEvent(event); 

/*  鏈夊叧涓婇潰鐨?onTouchEvent鏂規硶錛屾垜浠彲浠ョ洿鎺ュ垽鏂璏otionEvent鐨勭被鍨嬶紝

    瀵逛簬鎵嬪娍縐誨姩浠呬粎鎹曡幏ACTION_MOVE鍗沖彲錛?/p>

    鎴戜滑閫氳繃鍙傛暟MotionEvent e1, MotionEvent e2,float distanceX, float distanceY鍙互鑾峰彇鎿嶄綔鍙樺寲銆?/p>

   姣斿 distanceX > 0 鍚戝彸杈圭Щ鍔紝distanceX < 0 鍒欏悜宸﹁竟錛宒istanceY > 0 鍚戜笂婊氬姩錛?distanceY < 0 鍚戜笅婊氬姩銆?/span>

*/

}


class MyGestureListener extends GestureDetector.SimpleOnGestureListener{

  @Override

  public boolean onSingleTapUp(MotionEvent ev) {

    Log.d("onSingleTapUp",ev.toString());

    return true;

  }


  @Override

  public void onShowPress(MotionEvent ev) {

    Log.d("onShowPress",ev.toString());

  }


  @Override

  public void onLongPress(MotionEvent ev) {

    Log.d("onLongPress",ev.toString());

  }

}

 


鏇村鐨勫洖璋冩秷鎭紝鏂逛究鐨勫鐢ㄦ埛鐨勫姩浣滆繘琛屽搷搴?/span>

public interface OnGestureListener {

                // Touch down鏃惰Е鍙?/span>, e涓?/span>down鏃剁殑MotionEvent

                boolean onDown(MotionEvent e);

                // 鍦?/span>Touch down涔嬪悗涓瀹氭椂闂達紙115ms錛夎Е鍙戯紝e涓?/span>down鏃剁殑MotionEvent

                void onShowPress(MotionEvent e);

                // Touch up鏃惰Е鍙戯紝e涓?/span>up鏃剁殑MotionEvent

                boolean onSingleTapUp(MotionEvent e);

                // 婊戝姩鏃惰Е鍙戯紝e1涓?/span>down鏃剁殑MotionEvent錛?/span>e2涓?/span>move鏃剁殑MotionEvent

                boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY);

                // 鍦?/span>Touch down涔嬪悗涓瀹氭椂闂達紙500ms錛夎Е鍙戯紝e涓?/span>down鏃剁殑MotionEvent

                void onLongPress(MotionEvent e);

                // 婊戝姩涓孌佃窛紱伙紝up鏃惰Е鍙戯紝e1涓?/span>down鏃剁殑MotionEvent錛?/span>e2涓?/span>up鏃剁殑MotionEvent

                boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);

} 

public interface OnDoubleTapListener {

                // 瀹屾垚涓嬈″崟鍑伙紝騫剁‘瀹氭病鏈変簩鍑諱簨浠跺悗瑙﹀彂錛?/span>300ms錛夛紝e涓?/span>down鏃剁殑MotionEvent

                boolean onSingleTapConfirmed(MotionEvent e);

                // 絎簩嬈″崟鍑?/span>down鏃惰Е鍙戯紝e涓虹涓嬈?/span>down鏃剁殑MotionEvent

                boolean onDoubleTap(MotionEvent e);

                // 絎簩嬈″崟鍑?/span>down,move鍜?/span>up鏃墮兘瑙﹀彂錛?/span>e涓轟笉鍚屾椂鏈轟笅鐨?/span>MotionEvent

                boolean onDoubleTapEvent(MotionEvent e);

}

boolean  onDoubleTap(MotionEvent e)
瑙i噴錛氬弻鍑葷殑絎簩涓婽ouch down鏃惰Е鍙?/div>
boolean  onDoubleTapEvent(MotionEvent e)
瑙i噴錛氬弻鍑葷殑絎簩涓婽ouch down鍜寀p閮戒細瑙﹀彂錛屽彲鐢╡.getAction()鍖哄垎銆?/div>
boolean  onDown(MotionEvent e)
瑙i噴錛歍ouch down鏃惰Е鍙?/div>
boolean  onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
瑙i噴錛歍ouch浜嗘粦鍔ㄤ竴鐐硅窛紱誨悗錛寀p鏃惰Е鍙戙?/div>
void  onLongPress(MotionEvent e)
瑙i噴錛歍ouch浜嗕笉縐誨姩涓鐩碩ouch down鏃惰Е鍙?/div>
boolean  onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
瑙i噴錛歍ouch浜嗘粦鍔ㄦ椂瑙﹀彂銆?/div>
void  onShowPress(MotionEvent e)
瑙i噴錛歍ouch浜嗚繕娌℃湁婊戝姩鏃惰Е鍙?/div>
錛堜笌onDown錛宱nLongPress姣旇緝,onDown鍙Touch down涓瀹氱珛鍒昏Е鍙戙傝孴ouchdown鍚庤繃涓浼氭病鏈夋粦鍔ㄥ厛瑙﹀彂onShowPress鍐嶆槸onLongPress銆?/div>
鎵浠ouchdown鍚庝竴鐩翠笉婊戝姩錛宱nDown->onShowPress->onLongPress榪欎釜欏哄簭瑙﹀彂銆?/div>
boolean  onSingleTapConfirmed(MotionEvent e)
boolean  onSingleTapUp(MotionEvent e)
瑙i噴錛氫笂闈㈣繖涓や釜鍑芥暟閮芥槸鍦╰ouch down鍚庡張娌℃湁婊戝姩錛坥nScroll錛夛紝鍙堟病鏈夐暱鎸夛紙onLongPress錛夛紝鐒跺悗Touchup鏃惰Е鍙戙?/div>
鐐瑰嚮涓涓嬮潪甯稿揩鐨勶紙涓嶆粦鍔級Touchup錛?/div>
onDown->onSingleTapUp->onSingleTapConfirmed
鐐瑰嚮涓涓嬬◢寰參鐐圭殑錛堜笉婊戝姩錛塗ouchup錛?/div>
onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed




涔濆疂 2011-02-16 15:03 鍙戣〃璇勮
]]>onNewIntent 浠涔堟椂鍊欒皟鐢?/title><link>http://www.tkk7.com/yglwxl/archive/2011/02/14/344254.html</link><dc:creator>涔濆疂</dc:creator><author>涔濆疂</author><pubDate>Mon, 14 Feb 2011 03:18:00 GMT</pubDate><guid>http://www.tkk7.com/yglwxl/archive/2011/02/14/344254.html</guid><wfw:comment>http://www.tkk7.com/yglwxl/comments/344254.html</wfw:comment><comments>http://www.tkk7.com/yglwxl/archive/2011/02/14/344254.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/yglwxl/comments/commentRss/344254.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/yglwxl/services/trackbacks/344254.html</trackback:ping><description><![CDATA[<span style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22px; "> <div><span style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22px; "><span style="font-family: arial, sans-serif; font-size: 13px; line-height: normal; "> <h4 class="jd-details-title" style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 3px; padding-right: 95px; padding-bottom: 3px; padding-left: 3px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 1.1em; background-color: #e2e2e2; color: #222222; "><span id="h3h555t" class="normal" style="font-size: 0.9em; font-weight: normal; ">protected void </span><span id="rn3nnr1" class="sympad" style="margin-right: 2px; ">onNewIntent</span> <span id="txjpvbv" class="normal" style="font-size: 0.9em; font-weight: normal; ">(<a style="color: #006699; ">Intent</a> intent)</span></h4> <div id="tv3db5d" class="api-level" style="margin-top: -25px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 7px; padding-bottom: 0px; padding-left: 7px; border-style: initial; border-color: initial; font-size: 0.8em; font-weight: normal; color: #999999; float: right; ">Since: <a style="color: #999999; text-decoration: none; ">API Level 1</a></div> <div id="j5t5xhh" class="jd-details-descr" style="margin-top: 0.5em; margin-right: 0.25em; margin-bottom: 0.5em; margin-left: 0.25em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; "> <div id="lv3rlnz" class="jd-tagdata jd-tagdescr" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; line-height: 1em; "> <p style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; line-height: 1.3em; ">This is called for activities that set launchMode to "singleTop" in their package, or if a client used the<code style="color: #007000; font-family: monospace; line-height: 1em; "><a style="color: #006699; ">FLAG_ACTIVITY_SINGLE_TOP</a></code> flag when calling <code style="color: #007000; font-family: monospace; line-height: 1em; "><a style="color: #006699; ">startActivity(Intent)</a></code>. In either case, when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch it.</p> <p style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; line-height: 1.3em; ">An activity will always be paused before receiving a new intent, so you can count on <code style="color: #007000; font-family: monospace; line-height: 1em; "><a style="color: #006699; ">onResume()</a></code> being called after this method.</p> <p style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; line-height: 1.3em; ">Note that <code style="color: #007000; font-family: monospace; line-height: 1em; "><a style="color: #006699; ">getIntent()</a></code> still returns the original Intent. You can use <code style="color: #007000; font-family: monospace; line-height: 1em; "><a style="color: #006699; ">setIntent(Intent)</a></code> to update it to this new Intent.</p> </div> </div> </span></span></div> <div><span style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22px; "><br /> </span></div> 鍦↖ntentActivity涓噸鍐欎笅鍒楁柟娉曪細onCreate onStart onRestart  onResume  onPause onStop onDestroy  onNewIntent<br style="line-height: 22px; " /> 涓銆佸叾浠栧簲鐢ㄥ彂Intent錛屾墽琛屼笅鍒楁柟娉曪細<br style="line-height: 22px; " /> I/@@@philn(12410): onCreate<br style="line-height: 22px; " /> I/@@@philn(12410): onStart<br style="line-height: 22px; " /> I/@@@philn(12410): onResume<br style="line-height: 22px; " /> <br style="line-height: 22px; " /> 鍙慖ntent鐨勬柟娉?<br style="line-height: 22px; " /> Uri uri = Uri.parse("philn://blog.163.com");<br style="line-height: 22px; " /> Intent it = new Intent(Intent.ACTION_VIEW, uri);    <br style="line-height: 22px; " /> startActivity(it);<br style="line-height: 22px; " /> <br style="line-height: 22px; " /> 浜屻佹帴鏀禝ntent澹版槑錛?br style="line-height: 22px; " />  <activity android:name=".IntentActivity" android:launchMode="singleTask"<br style="line-height: 22px; " />                   android:label="@string/testname"><br style="line-height: 22px; " />              <intent-filter><br style="line-height: 22px; " />                 <action android:name="android.intent.action.VIEW" /><br style="line-height: 22px; " />                 <category android:name="android.intent.category.DEFAULT" /><br style="line-height: 22px; " />                 <category android:name="android.intent.category.BROWSABLE" /><br style="line-height: 22px; " />                 <data android:scheme="philn"/><br style="line-height: 22px; " />             </intent-filter><br style="line-height: 22px; " />   </activity><br style="line-height: 22px; " /> <br style="line-height: 22px; " /> 涓夈佸鏋淚ntentActivity澶勪簬浠誨姟鏍堢殑欏剁錛屼篃灝辨槸璇翠箣鍓嶆墦寮榪囩殑Activity錛岀幇鍦ㄥ浜?br style="line-height: 22px; " /> I/@@@philn(12410): onPause<br style="line-height: 22px; " /> I/@@@philn(12410): onStop 鐘舵佺殑璇?br style="line-height: 22px; " /> 鍏朵粬搴旂敤鍐嶅彂閫両ntent鐨勮瘽錛屾墽琛岄『搴忎負錛?br style="line-height: 22px; " /> I/@@@philn(12410): onNewIntent<br style="line-height: 22px; " /> I/@@@philn(12410): onRestart<br style="line-height: 22px; " /> I/@@@philn(12410): onStart<br style="line-height: 22px; " /> I/@@@philn(12410): onResume</span> <img src ="http://www.tkk7.com/yglwxl/aggbug/344254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/yglwxl/" target="_blank">涔濆疂</a> 2011-02-14 11:18 <a href="http://www.tkk7.com/yglwxl/archive/2011/02/14/344254.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Observer妯″紡鍦↗2EE涓殑瀹炵幇 [http://35java.com/zhibo/forum.php?mod=viewthread&tid=108&extra=page%3D3]http://www.tkk7.com/yglwxl/archive/2011/02/13/344203.html涔濆疂涔濆疂Sun, 13 Feb 2011 11:24:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/02/13/344203.htmlhttp://www.tkk7.com/yglwxl/comments/344203.htmlhttp://www.tkk7.com/yglwxl/archive/2011/02/13/344203.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/344203.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/344203.html寮曡█錛?/span>
            璁捐妯″紡鏄粡楠岀殑鏂囨。鍖栥傚畠鏄琚敤鏉ュ湪鐗瑰畾鍦烘櫙涓嬭В鍐充竴鑸璁¢棶棰樼殑綾誨拰鐩鎬簰閫氫俊鐨勫璞$殑鎻忚堪銆傛洿閫氫織鐨勬潵璇達紝瀹冩槸涓涓棶棰?瑙e喅鏂規瀵廣備竴鏃︽垜浠帉鎻′簡璁捐妯″紡錛屽氨絳変簬鎷ユ湁浜嗕竴鏀己鏈夊姏鐨勪笓瀹墮槦浼嶃傚畠鐢氳嚦鑳藉浣塊潰鍚戝璞$殑鏂版墜鍒╃敤鍓嶄漢鐨勭粡楠屾壘鍑鴻亴璐f槑紜殑綾誨拰瀵硅薄錛屼粠鑰岃幏寰椾紭闆呯殑瑙e喅鏂規銆傜敱浜庤璁℃ā寮忎篃鏄噸鏋勭殑鐩爣錛屽鏋滃湪璁捐鐨勫垵鏈熼傚綋鍦板紩鍏ヨ璁℃ā寮忥紝鍙互鍑忓皯閲嶆瀯鐨勫伐浣滈噺銆?/span>
      浣嗘槸錛屾垜浠篃涓嶈兘闄峰叆妯″紡鐨勯櫡闃憋紝涓轟簡浣跨敤妯″紡鑰屽幓濂楁ā寮忥紝閭f牱浼氶櫡鍏ュ艦寮忎富涔夈傛垜浠湪浣跨敤妯″紡鐨勬椂鍊欙紝涓瀹氳娉ㄦ剰妯″紡鐨勬剰鍥撅紙intent錛夛紝鑰屼笉瑕佽繃澶氱殑鍘誨叧娉ㄦā寮忕殑瀹炵幇緇嗚妭錛屽洜涓鴻繖浜涘疄鐜扮粏鑺傚湪鐗瑰畾鎯呭喌涓嬶紝鍙兘浼氬彂鐢熶竴浜涙敼鍙樸備笉瑕侀〗鍥哄湴璁や負璁捐妯″紡涓涔︿腑鐨勭被鍥炬垨瀹炵幇浠g爜灝變唬琛ㄤ簡妯″紡鏈韓銆?/span>
      涓嬮潰錛屾垜浠潵璁ㄨ涓涓嬩負浠涔堣鍦ㄥ垎甯冨紡銆佸灞傜郴緇熶腑浣跨敤Observer妯″紡銆?/span>
      

澶氬眰浣撶郴緇撴瀯錛坢ulti-tier architecture錛夛細
            涓夊眰浣撶郴緇撴瀯鏄灞備綋緋葷粨鏋勪腑鏈綆鍗曠殑涓縐嶏紝瀹冧竴鑸寘鎷細
      
  • 琛ㄧず灞?presentation)錛嶇獥鍙c佹姤琛?
  • 涓氬姟閫昏緫灞?business logic)錛嶇鐞嗕笟鍔¤繃紼嬬殑浠誨姟鍜岃鍒欍傚畠鍙堝彲浠ョ粏鍒嗕負棰嗗煙瀵硅薄灞傦紙浠h〃棰嗗煙姒傚康錛夊拰鏈嶅姟灞傦紙鎻愪緵鏁版嵁搴撲氦浜掋佸畨鍏ㄦс佹墦鍗版姤琛級銆?/li>
  • 瀛樺偍灞?storage)錛嶆寔涔呭寲瀛樺偍鏈哄埗銆傚鏁版嵁搴撴湇鍔″櫒絳夈?br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-wrap: break-word; " />
              
鍥句竴錛氫笁灞備綋緋葷粨鏋?/strong>
              
      鑰孞ava 2騫沖彴浼佷笟鐗堬紙J2EE錛夋槸涓縐嶅埄鐢↗ava 2騫沖彴鏉ョ畝鍖栬澶氫笌澶氱駭浼佷笟瑙e喅鏂規鐨勫紑鍙戙侀儴緗插拰綆$悊鐩稿叧鐨勫鏉傞棶棰樼殑浣撶郴緇撴瀯銆傚畠鏄紑鏀劇殑銆佸熀浜庢爣鍑嗙殑騫沖彴錛岀敤浠ュ紑鍙戙侀儴緗插拰綆$悊N灞傜粨鏋勩侀潰鍚慦eb鐨勶紝浠ユ湇鍔″櫒涓轟腑蹇冪殑浼佷笟綰у簲鐢ㄣ?/span>
      涓轟簡鏀寔棰嗗煙瀵硅薄鐨勫鐢紝騫朵笖浣塊鍩熷璞$殑鎺ュ彛鍙樻洿鎵甯︽潵鐨勫獎鍝嶆渶灝忓寲銆傛垜浠皢棰嗗煙灞傦紙妯″瀷錛夊拰琛ㄧず灞傦紙瑙嗗浘錛夌浉鍒嗙銆?/span>
      閲囩敤妯″瀷錛嶈鍥炬ā寮忕殑鎰忎箟鍦ㄤ簬錛?/span>
      
  • 鏀寔鑱氬悎搴︽洿楂樼殑妯″瀷瀹氫箟錛屼嬌妯″瀷鐨勫畾涔夊彲浠ラ泦涓湪棰嗗煙榪囩▼鐨勫畾涔夛紝鑰屼笉鏄浘褰㈢晫闈笂銆?/li>
  • 鍏佽灝嗘ā鍨嬪拰鐢ㄦ埛鐣岄潰騫惰寮鍙戙?/li>
  • 浣跨敤鎴風晫闈㈢殑闇姹傚彉鍖栧棰嗗煙灞傛墍閫犳垚鐨勫獎鍝嶆渶灝忓寲銆?/li>
  • 鍏佽寤虹珛涓庝竴涓幇鏈夌殑棰嗗煙灞傚璞$浉榪炴帴鐨勬柊瑙嗗浘錛屽悓鏃朵笉褰卞搷棰嗗煙灞傘?/li>
  • 鍏佽涓涓ā鍨嬪悓鏃舵湁澶氫釜瑙嗗浘錛屼緥濡備嬌鐢⊿VG鍜岃〃鏍箋?/li>
  • 鍏佽妯″瀷灞傜嫭绔嬩簬鐢ㄦ埛鐣岄潰灞傛墽琛屻?br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-wrap: break-word; " />
      鑰岃繖鎭版伆涓嶰bserver妯″紡鐨勬剰鍥劇浉鍚誨悎銆傚洜姝ゆ垜浠湁蹇呰璺ㄥ眰鏉ュ疄鐜癘bserver妯″紡銆?/span>
      鍏跺疄錛屽湪搴旂敤涓洿澶氱殑鏄噰鐢∕VC妗嗘灦鏉ユ灦鏋勬暣涓紒涓氬簲鐢ㄧ殑銆傚湪MVC妗嗘灦涓紝Model鍜孷iew涔嬮棿瀛樺湪鐫渚濊禆鍏崇郴錛屾槸Observer妯″紡鐨勫吀鍨嬪簲鐢ㄣ傚綋鐒禡VC妗嗘灦榪樺寘鎷叾瀹冩ā寮忓Composite妯″紡鍜孲trategy妯″紡銆傚湪J2EE騫沖彴涓紝鎴戜滑鍙互鎶奧eb Tier錛堝寘鎷琂sp鍜宻ervelet鍜孞avaBean錛夌湅浣滄槸琛ㄧず灞傦紝EJB Tier鐪嬩綔鏄鍩熷眰銆傝宑ontroller鍙兘璺ㄨ窛Web Tier鍜?EJB Tier銆?/span>
      鍦↗ava綾誨簱涓噰鐢↗ava.util.Observable綾誨拰Java.util.Observer鎺ュ彛鏉ュ疄鐜癘bserver妯″紡錛屽畠浠湪鍗曚釜鐨凧ava VM.涓繍琛岀殑寰堝ソ錛屼絾濡傛灉鎯沖湪EJB涓嬌鐢ㄥ畠浠氨浼氭湁涓浜涢棶棰樸傝繖姝e鎴戜滑寮曡█涓彁鍒扮殑錛屾ā寮忕殑鍏蜂綋瀹炵幇鍦ㄧ壒瀹氭儏鍐典笅錛屽彲鑳戒細鍙戠敓涓浜涙敼鍙樸?/span>
      

鍊間紶閫掕繕鏄繙紼嬪紩鐢ㄤ紶閫掞紵
                    鍊間紶閫掞細        
鍦↗ava RMI涓姹傛墍鏈夌殑鍙傛暟鍜岃繑鍥炵被鍨嬫槸JAVA鐨勫熀鏈被鍨嬫垨瀹炵幇Java.io.Serilizable鐨勫璞°備覆琛屽寲瀵硅薄閫氳繃鍊間紶閫掞紙鍙堝悕鎷瘋礉浼犻掞級錛岃屼笉鏄紩鐢ㄤ紶閫掞紝榪欐剰鍛崇潃鍦ㄦ煇涓灞備腑涓茶鍖栧璞$殑鏇村茍涓嶈嚜鍔ㄥ獎鍝嶅埌鍏跺畠鐨勫璞°?nbsp;     
              榪滅▼寮曠敤浼犻掞細        
瀵逛簬EJB瀵硅薄鑰岃█錛屽畠鐢變袱涓帴鍙o紙home鎺ュ彛鍜宺emote鎺ュ彛錛夊拰涓涓被緇勬垚銆傚鍣ㄤ細鏍規嵁ejb瑙勮寖鏉ョ敓鎴愬疄鐜頒笂闈袱涓帴鍙g殑綾伙紙鎴戜滑鍒嗗埆縐頒負xxxEJBHome瀵硅薄鍜寈xxEjbObject瀵硅薄錛夈傚湪杈冨鐨勫鍣ㄧ殑瀹炵幇鏂規涓紝xxxEJBHome瀵硅薄浣跨敤浜唂actory妯″紡鏉ュ垱寤簒xxEjbObject瀵硅薄錛泋xxEjbObject瀵硅薄鍒欓噰鐢╬roxy妯″紡錛屼綔涓簒xxBean鐨勪唬鐞嗙被銆傚湪鐢熸垚浠ヤ笂涓や釜瀵硅薄鐨勫悓鏃訛紝瀹瑰櫒浼氫粠閮ㄧ講鏂囦歡涓鍙栧叧浜庡畨鍏ㄣ佷簨鍔°佹寔涔呮х瓑鏈嶅姟騫跺湪xxxEjbObject瀵硅薄鍜寈xxEJBHome瀵硅薄涓坊鍔犱互涓婃湇鍔$殑浠g爜銆傝屼笖xxxEJBHome瀵硅薄鍜寈xxEjbObject瀵硅薄閮芥槸鍒嗗竷寮忓璞★紝鎴戜滑鍦ㄦ鍙璁簒xxEjbObject瀵硅薄銆傛墍璋撳垎甯冨紡瀵硅薄錛屼粠鏈川涓婃潵璁詫紝鍒嗕負3涓儴鍒嗭細object server銆乻keleton銆乻tub銆傚叾涓璷bject server鍜宻keleton浣嶄簬鏈嶅姟鍣ㄧ錛岃宻tub浣嶄簬瀹㈡埛绔侽bject server璐熻矗瀹炵幇涓氬姟閫昏緫錛宻keleton璐熻矗marshal鍜寀nmarshal鏂規硶絳懼悕銆?nbsp;     
              
鍥句簩錛氬垎甯冨紡瀵硅薄
              
      鏄劇劧錛孍JB鐨勫鎴鳳紙璋冪敤EJB鐨勫璞★級鍙互鏄換浣曞璞★紝鍖呮嫭EJB鍜屼竴鑸殑Java綾葷敋鑷蟲槸鐢ㄤ換浣曡璦鍐欑殑corba瀹㈡埛绔?/span>
      浠嶦JB鐨勫鎴瘋瑙掓潵鐪嬬殑璇濓紝鎴戜滑鍙兘鐪嬪埌涓涓猦ome鎺ュ彛銆佷竴涓猺emote鎺ュ彛錛堝浜庡疄浣揵ean鐨勮瘽錛岃繕鍙互鐪嬭涓涓富閿被錛岃宐ean綾誨瀹㈡埛鏄笉鍙鐨勶級銆備絾鎴戜滑浠庝笂闈㈢殑璁鴻堪錛屾垜浠彲浠ョ煡閬擄紝瀵逛簬remote鎺ュ彛涓湴鏂規硶璋冪敤錛屽疄闄呬笂鏄鎬佸湴璋冪敤XXX_Stub綾匯傚嵆XXX_Stub瀵硅薄瀵瑰鎴峰叿鏈夊彲瑙佹э紙浣嗚繖縐嶅彲瑙佹ф槸閫忔槑鐨勶紝鍗沖鎴蜂笉鐭ラ亾榪欑鍙鎬х殑瀛樺湪錛夈傜敱浜庯紝XXX_Stub瀵硅薄鍜孫bject Server瀹炵幇浜嗙浉鍚岀殑鎺ュ彛錛屽茍涓擮bject server鐪熸瀹炵幇浜嗕笟鍔¢昏緫銆傛墍浠ワ紝褰撳湪瀹㈡埛绔皟鐢╔XX_Stub瀵硅薄鐨勬柟娉曟椂鍊欙紝XXX_Stub瀵硅薄閫氳繃socket閫氫俊鏈哄埗灝嗘柟娉曠鍚嶄紶緇橷XX_Skeleton瀵硅薄錛孹XX_Skeleton瀵硅薄鍦ㄥ幓濮旀墭Object Server瀹屾垚涓氬姟澶勭悊閫昏緫銆傚洜姝わ紝Object Server鏈韓鍙戠敓浜嗘敼鍙樸傛垜浠ОXXX_Stub瀵硅薄鏄疧bject Server瀵硅薄鐨勮繙紼嬪紩鐢紝騫惰涓哄綋鍒嗗竷寮忓璞′綔涓哄弬鏁頒紶閫掔殑鏃跺欙紝鏄氳繃寮曠敤浼犻掔殑錛堜細浜х敓鍓綔鐢?/span>

涔濆疂 2011-02-13 19:24 鍙戣〃璇勮
]]>
RMI鐨勫畾涔?杞?http://blog.csdn.net/ocean181/archive/2010/09/02/5857273.aspxhttp://www.tkk7.com/yglwxl/archive/2011/02/13/344202.html涔濆疂涔濆疂Sun, 13 Feb 2011 10:46:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/02/13/344202.htmlhttp://www.tkk7.com/yglwxl/comments/344202.htmlhttp://www.tkk7.com/yglwxl/archive/2011/02/13/344202.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/344202.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/344202.htmlRMI鐨勫畾涔?/h2>

Java RMI 錛圧emote Method Invocation 榪滅▼鏂規硶璋冪敤錛夋槸鐢↗ava鍦?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">JDK1.1涓疄鐜扮殑錛屽畠澶уぇ澧炲己浜咼ava寮鍙戝垎甯冨紡搴旂敤鐨勮兘鍔涖侸ava浣滀負涓縐嶉闈′竴鏃剁殑緗戠粶寮鍙戣璦錛屽叾宸ㄥぇ鐨勫▉鍔涘氨浣撶幇鍦ㄥ畠寮哄ぇ鐨勫紑鍙戝垎甯冨紡緗戠粶搴旂敤鐨勮兘鍔涗笂錛岃孯MI灝辨槸寮鍙戠櫨鍒嗕箣鐧劇函Java鐨勭綉緇滃垎甯冨紡搴旂敤緋葷粺鐨勬牳蹇冭В鍐蟲柟妗堜箣涓銆傚叾瀹炲畠鍙互琚湅浣滄槸RPC鐨凧ava鐗堟湰銆備絾鏄紶緇?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">RPC騫朵笉鑳藉緢濂藉湴搴旂敤浜庡垎甯冨紡瀵硅薄緋葷粺銆傝孞ava RMI 鍒欐敮鎸佸瓨鍌ㄤ簬涓嶅悓鍦板潃絀洪棿鐨?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">紼嬪簭綰у璞′箣闂村郊姝よ繘琛岄氫俊錛屽疄鐜拌繙紼嬪璞′箣闂寸殑鏃犵紳榪滅▼璋冪敤銆?/p>

RMI鐩墠浣跨敤Java榪滅▼娑堟伅浜ゆ崲鍗忚JRMP錛圝ava Remote Messaging Protocol錛夎繘琛岄氫俊銆侸RMP鏄笓涓篔ava鐨勮繙紼嬪璞″埗瀹氱殑鍗忚銆傚洜姝わ紝Java RMI鍏鋒湁Java鐨?#8220;Write Once,Run Anywhere”鐨勪紭鐐癸紝鏄垎甯冨紡搴旂敤緋葷粺鐨勭櫨鍒嗕箣鐧劇函Java瑙e喅鏂規銆傜敤Java RMI寮鍙戠殑搴旂敤緋葷粺鍙互閮ㄧ講鍦ㄤ換浣曟敮鎸?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">JRE錛圝ava Run Environment Java錛岃繍琛?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">鐜錛夌殑騫沖彴涓娿備絾鐢變簬JRMP鏄笓涓篔ava瀵硅薄鍒跺畾鐨勶紝鍥犳錛孯MI瀵逛簬鐢ㄩ潪Java璇█寮鍙戠殑搴旂敤緋葷粺鐨勬敮鎸佷笉瓚熾備笉鑳戒笌鐢ㄩ潪Java璇█涔﹀啓鐨勫璞¤繘琛岄氫俊銆?/p>

RMI涓?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">CORBA鐨勫叧緋?/h2>

RMI 鍜孋ORBA甯歌瑙嗕負鐩鎬簰绔炰簤鐨?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">鎶鏈?/a>錛屽洜涓轟袱鑰呴兘鎻愪緵瀵硅繙紼嬪垎甯冨紡瀵硅薄鐨勯忔槑璁塊棶銆備絾榪欎袱縐嶆妧鏈疄闄呬笂鏄浉浜掕ˉ鍏呯殑錛屼竴鑰呯殑闀垮姝eソ鍙互寮ヨˉ鍙︿竴鑰呯殑鐭銆俁MI 鍜?CORBA 鐨勭粨鍚堜駭鐢熶簡 RMI-IIOP錛孯MI-IIOP 鏄紒涓?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">鏈嶅姟鍣?/a>绔?Java 寮鍙戠殑鍩虹

1997 騫達紝IBM 鍜?Sun Microsystems鍚姩浜嗕竴欏規棬鍦ㄤ績榪?Java 浣滀負浼佷笟寮鍙戞妧鏈殑鍙戝睍鐨勫悎浣滆鍒掋備袱瀹跺叕鍙哥壒鍒潃鍔涗簬濡備綍灝?Java 鐢ㄤ綔鏈嶅姟鍣ㄧ璇█錛岀敓鎴愬彲浠ョ粨鍚堣繘鐜版湁浣撶郴緇撴瀯鐨勪紒涓氱駭浠g爜銆傛墍闇瑕佺殑灝辨槸涓縐嶈繙紼嬩紶杈撴妧鏈紝瀹冨吋鏈?Java 鐨?RMI錛圧emote Method Invocation錛岃繙紼嬫柟娉曡皟鐢級杈冨皯鐨?a class="channel_keylink" target="_blank" style="text-decoration: none; color: #336601; ">璧勬簮鍗犵敤閲忓拰鏇存垚鐔熺殑 CORBA錛圕ommon Object Request Broker Architecture錛屽叕鍏卞璞¤姹備唬鐞嗕綋緋葷粨鏋勶級鎶鏈殑鍋ュ.鎬с傚嚭浜庤繖涓闇瑕侊紝RMI-IIOP闂笘浜嗭紝瀹冨府鍔╁皢 Java 璇█鎺ㄥ悜浜嗙洰鍓嶆湇鍔″櫒绔紒涓氬紑鍙戠殑涓繪祦璇█鐨勯鍏堝湴浣嶃?/p>

RMI鐨勭粍鎴?/h2>

涓涓甯稿伐浣滅殑RMI緋葷粺鐢變笅闈㈠嚑涓儴鍒嗙粍鎴愶細

1銆佽繙紼嬫湇鍔$殑鎺ュ彛瀹氫箟

2銆佽繙紼嬫湇鍔℃帴鍙g殑鍏蜂綋瀹炵幇

3銆佹々錛圫tub錛夊拰妗嗘灦錛圫keleton錛夋枃浠?/p>

4銆佷竴涓繍琛岃繙紼嬫湇鍔$殑鏈嶅姟鍣?/p>

5銆佷竴涓猂MI鍛藉悕鏈嶅姟錛屽畠鍏佽瀹㈡埛绔幓鍙戠幇榪欎釜榪滅▼鏈嶅姟

6銆佺被鏂囦歡鐨勬彁渚涜咃紙涓涓狧TTP鎴栬匜TP鏈嶅姟鍣級

7銆佷竴涓渶瑕佽繖涓繙紼嬫湇鍔$殑瀹㈡埛绔▼搴?/p>

RMI鐨勫疄鐜?/h2>

涓嬮潰鎴戜滑涓姝ヤ竴姝ュ緩绔嬩竴涓畝鍗曠殑RMI緋葷粺銆傞鍏堝湪浣犵殑鏈哄櫒閲屽緩绔嬩竴涓柊鐨勬枃浠跺す錛屼互渚挎斁緗垜浠垱寤虹殑鏂囦歡錛屼負浜嗙畝鍗曡搗瑙侊紝鎴戜滑鍙嬌鐢ㄤ竴涓枃浠跺す瀛樻斁瀹㈡埛绔拰鏈嶅姟绔唬鐮侊紝騫朵笖鍦ㄥ悓涓涓洰褰曚笅榪愯鏈嶅姟绔拰瀹㈡埛绔?br />
濡傛灉鎵鏈夌殑RMI鏂囦歡閮藉凡緇忚璁″ソ浜嗭紝閭d箞浣犻渶瑕佷笅闈㈢殑鍑犱釜姝ラ鍘葷敓鎴愪綘鐨勭郴緇燂細

1銆?nbsp;  緙栧啓騫朵笖緙栬瘧鎺ュ彛鐨凧ava浠g爜
2銆?nbsp;  緙栧啓騫朵笖緙栬瘧鎺ュ彛瀹炵幇鐨凧ava浠g爜
3銆?nbsp;  浠庢帴鍙e疄鐜扮被涓敓鎴?Stub 鍜?Skeleton 綾繪枃浠?br /> 4銆?nbsp;  緙栧啓榪滅▼鏈嶅姟鐨勪富榪愯紼嬪簭
5銆?nbsp;  緙栧啓RMI鐨勫鎴風紼嬪簭
6銆?nbsp;  瀹夎騫朵笖榪愯RMI緋葷粺

1銆佹帴鍙?br />
絎竴姝ュ氨鏄緩绔嬪拰緙栬瘧鏈嶅姟鎺ュ彛鐨凧ava浠g爜銆傝繖涓帴鍙e畾涔変簡鎵鏈夌殑鎻愪緵榪滅▼鏈嶅姟鐨勫姛鑳斤紝涓嬮潰鏄簮紼嬪簭錛?br />
   1. //Calculator.java
   2. //define the interface
   3. import java.rmi.Remote;
   4.
   5. public interface Calculator extends Remote
   6. {
   7.     public long add(long a, long b)
   8.         throws java.rmi.RemoteException;
   9.
  10.     public long sub(long a, long b)
  11.         throws java.rmi.RemoteException;
  12.
  13.     public long mul(long a, long b)
  14.         throws java.rmi.RemoteException;
  15.
  16.     public long div(long a, long b)
  17.         throws java.rmi.RemoteException;
  18. }


娉ㄦ剰錛岃繖涓帴鍙g戶鎵胯嚜Remote錛屾瘡涓涓畾涔夌殑鏂規硶閮藉繀欏繪姏鍑轟竴涓猂emoteException寮傚父瀵硅薄銆?br />
寤虹珛榪欎釜鏂囦歡錛屾妸瀹冨瓨鏀懼湪鍒氭墠鐨勭洰褰曚笅錛屽茍涓旂紪璇戙?br />
>javac Calculator.java

2銆佹帴鍙g殑鍏蜂綋瀹炵幇

涓嬩竴姝ワ紝鎴戜滑灝辮鍐欒繙紼嬫湇鍔$殑鍏蜂綋瀹炵幇錛岃繖鏄竴涓狢alculatorImpl綾繪枃浠訛細

   1. //CalculatorImpl.java
   2. //Implementation
   3. import java.rmi.server.UnicastRemoteObject;
   4.
   5. public class CalculatorImpl extends UnicastRemoteObject implements Calculator
   6. {
   7.
   8.     // 榪欎釜瀹炵幇蹇呴』鏈変竴涓樉寮忕殑鏋勯犲嚱鏁幫紝騫朵笖瑕佹姏鍑轟竴涓猂emoteException寮傚父
   9.     public CalculatorImpl()
  10.         throws java.rmi.RemoteException {
  11.         super();
  12.      }
  13.
  14.     public long add(long a, long b)
  15.         throws java.rmi.RemoteException {
  16.         return a + b;
  17.      }
  18.
  19.     public long sub(long a, long b)
  20.         throws java.rmi.RemoteException {
  21.         return a - b;
  22.      }
  23.
  24.     public long mul(long a, long b)
  25.         throws java.rmi.RemoteException {
  26.         return a * b;
  27.      }
  28.
  29.     public long div(long a, long b)
  30.         throws java.rmi.RemoteException {
  31.         return a / b;
  32.      }
  33. }


鍚屾牱鐨勶紝鎶婅繖涓枃浠朵繚瀛樺湪浣犵殑鐩綍閲岀劧鍚庣紪璇戜粬銆?br />
榪欎釜瀹炵幇綾諱嬌鐢ㄤ簡UnicastRemoteObject鍘昏仈鎺MI緋葷粺銆傚湪鎴戜滑鐨勪緥瀛愪腑錛屾垜浠槸鐩存帴鐨勪粠UnicastRemoteObject 榪欎釜綾諱笂緇ф壙鐨勶紝浜嬪疄涓婂茍涓嶄竴瀹氳榪欐牱鍋氾紝濡傛灉涓涓被涓嶆槸浠嶶nicastRmeoteObject涓婄戶鎵匡紝閭e繀欏諱嬌鐢ㄥ畠鐨別xportObject() 鏂規硶鍘昏仈鎺ュ埌RMI銆?br />
濡傛灉涓涓被緇ф壙鑷猆nicastRemoteObject錛岄偅涔堝畠蹇呴』鎻愪緵涓涓瀯閫犲嚱鏁板茍涓斿0鏄庢姏鍑轟竴涓猂emoteException瀵硅薄銆傚綋榪欎釜鏋勯犲嚱鏁拌皟鐢ㄤ簡super()錛屽畠涔呮縺媧籙nicastRemoteObject涓殑浠g爜瀹屾垚RMI鐨勮繛鎺ュ拰榪滅▼瀵硅薄鐨勫垵濮嬪寲銆?br />
3銆丼tubs 鍜孲keletons

涓嬩竴姝ュ氨鏄浣跨敤RMI緙栬瘧鍣╮mic鏉ョ敓鎴愭々鍜屾鏋舵枃浠訛紝榪欎釜緙栬瘧榪愯鍦ㄨ繙紼嬫湇鍔″疄鐜扮被鏂囦歡涓娿?br />
>rmic CalculatorImpl

鍦ㄤ綘鐨勭洰褰曚笅榪愯涓婇潰鐨勫懡浠わ紝鎴愬姛鎵ц瀹屼笂闈㈢殑鍛戒護浣犲彲浠ュ彂鐜頒竴涓狢alculator_stub.class鏂囦歡錛屽鏋滀綘鏄嬌鐢ㄧ殑Java2SDK錛岄偅涔堜綘榪樺彲浠ュ彂鐜癈alculator_Skel.class鏂囦歡銆?br />
4銆佷富鏈烘湇鍔″櫒

榪滅▼RMI鏈嶅姟蹇呴』鏄湪涓涓湇鍔″櫒涓繍琛岀殑銆侰alculatorServer綾繪槸涓涓潪甯哥畝鍗曠殑鏈嶅姟鍣ㄣ?br />
   1. //CalculatorServer.java
   2. import java.rmi.Naming;
   3.
   4. public class CalculatorServer {
   5.
   6.    public CalculatorServer() {
   7.      try {
   8.         Calculator c = new CalculatorImpl();
   9.        Naming.rebind("rmi://localhost:1099/CalculatorService", c);
  10.       } catch (Exception e) {
  11.        System.out.println("Trouble: " + e);
  12.       }
  13.     }
  14.
  15.    public static void main(String args[]) {
  16.      new CalculatorServer();
  17.     }
  18. }


寤虹珛榪欎釜鏈嶅姟鍣ㄧ▼搴忥紝鐒跺悗淇濆瓨鍒頒綘鐨勭洰褰曚笅錛屽茍涓旂紪璇戝畠銆?br />
5銆佸鎴風

瀹㈡埛绔簮浠g爜濡備笅錛?br />
   //CalculatorClient.java
   
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.net.MalformedURLException;
   import java.rmi.NotBoundException;
   
   public class CalculatorClient {
   
       public static void main(String[] args) {
         try {
             Calculator c = (Calculator)
                              Naming.lookup(
                    "rmi://localhost
                            /CalculatorService");
               System.out.println( c.sub(4, 3) );
            System.out.println( c.add(4, 5) );
               System.out.println( c.mul(3, 6) );
              System.out.println( c.div(9, 3) );
            }
           catch (MalformedURLException murle) {
               System.out.println();
              System.out.println(
                 "MalformedURLException");
               System.out.println(murle);
            }
           catch (RemoteException re) {
              System.out.println();
               System.out.println(
                          "RemoteException");
               System.out.println(re);
           }
          catch (NotBoundException nbe) {
              System.out.println();
               System.out.println(
                          "NotBoundException");
               System.out.println(nbe);
            }
           catch (
               java.lang.ArithmeticException
                                         ae) {
              System.out.println();
              System.out.println(
               "java.lang.ArithmeticException");
             System.out.println(ae);
            }
       }
   }

淇濆瓨榪欎釜瀹㈡埛绔▼搴忓埌浣犵殑鐩綍涓嬶紙娉ㄦ剰榪欎釜鐩綍鏄竴寮濮嬪緩绔嬮偅涓紝鎵鏈夌殑鎴戜滑鐨勬枃浠墮兘鍦ㄩ偅涓洰褰曚笅錛夛紝騫朵笖緙栬瘧浠栥?br />
6銆佽繍琛孯MI緋葷粺

鐜板湪鎴戜滑寤虹珛浜嗘墍鏈夎繍琛岃繖涓畝鍗昍MI緋葷粺鎵闇鐨勬枃浠訛紝鐜板湪鎴戜滑緇堜簬鍙互榪愯榪欎釜RMI緋葷粺鍟︼紒鏉ヤ韓鍙楀惂銆?br />
鎴戜滑鏄湪鍛戒護鎺у埗鍙頒笅榪愯榪欎釜緋葷粺鐨勶紝浣犲繀欏誨紑鍚笁涓帶鍒跺彴紿楀彛錛屼竴涓繍琛屾湇鍔″櫒錛屼竴涓繍琛屽鎴風錛岃繕鏈変竴涓繍琛孯MIRegistry銆?br />
棣栧厛榪愯娉ㄥ唽紼嬪簭RMIRegistry錛屼綘蹇呴』鍦ㄥ寘鍚綘鍒氬啓鐨勭被鐨勯偅涔堢洰褰曚笅榪愯榪欎釜娉ㄥ唽紼嬪簭銆?br />
>rmiregistry

濂斤紝榪欎釜鍛戒護鎴愬姛鐨勮瘽錛屾敞鍐岀▼搴忓凡緇忓紑濮嬭繍琛屼簡錛屼笉瑕佺浠栵紝鐜板湪鍒囨崲鍒板彟澶栦竴涓帶鍒跺彴錛屽湪絎簩涓帶鍒跺彴閲岋紝鎴戜滑榪愯鏈嶅姟鍣–alculatorService錛屽洜涓篟MI鐨勫畨鍏ㄦ満鍒跺皢鍦ㄦ湇鍔$鍙戠敓浣滅敤,鎵浠ヤ綘蹇呴』澧炲姞涓鏉″畨鍏ㄧ瓥鐣ャ備互涓嬫槸瀵瑰簲瀹夊叏絳栫暐鐨勪緥瀛?br /> grant {
permission java.security.AllPermission "", "";
};

娉ㄦ剰:榪欐槸涓鏉℃渶綆鍗曠殑瀹夊叏絳栫暐,瀹冨厑璁鎬換浣曚漢鍋氫換浣曚簨,瀵逛簬浣犵殑鏇村姞鍏抽敭鎬х殑搴旂敤,浣犲繀欏繪寚瀹氭洿鍔犺緇嗗畨鍏ㄧ瓥鐣ャ?br />
鐜板湪涓轟簡榪愯鏈嶅姟绔紝浣犻渶瑕侀櫎瀹㈡埛綾?CalculatorClient.class)涔嬪鐨勬墍鏈夌殑綾繪枃浠躲傜‘璁ゅ畨鍏ㄧ瓥鐣ュ湪policy.txt鏂囦歡涔嬪悗,浣跨敤濡備笅鍛戒護鏉ヨ繍琛屾湇鍔″櫒銆?br />
> java -Djava.security.policy=policy.txt CalculatorServer

榪欎釜鏈嶅姟鍣ㄥ氨寮濮嬪伐浣滀簡錛屾妸鎺ュ彛鐨勫疄鐜板姞杞藉埌鍐呭瓨絳夊緟瀹㈡埛绔殑鑱旀帴銆傚ソ鐜板湪鍒囨崲鍒扮涓変釜鎺у埗鍙幫紝鍚姩鎴戜滑鐨勫鎴風銆?br />
涓轟簡鍦ㄥ叾浠栫殑鏈哄櫒榪愯瀹㈡埛绔▼搴忎綘闇瑕佷竴涓繙紼嬫帴鍙?Calculator.class) 鍜屼竴涓猻tub(CalculatorImpl_Stub.class)銆?浣跨敤濡備笅鍛戒護榪愯瀹㈡埛绔?br />
> java -Djava.security.policy=policy.txt CalculatorClient

濡傛灉鎵鏈夌殑榪欎簺閮芥垚鍔熻繍琛岋紝浣犲簲璇ョ湅鍒頒笅闈㈢殑杈撳嚭錛?br /> 1
9
18
3

濡傛灉浣犵湅鍒頒簡涓婇潰鐨勮緭鍑猴紝鎭枩浣狅紝浣犳垚鍔熶簡錛屼綘宸茬粡鎴愬姛鐨勫垱寤轟簡涓涓猂MI緋葷粺錛屽茍涓斾嬌浠栨紜伐浣滀簡銆傚嵆浣夸綘榪愯鍦ㄥ悓涓涓綆楁満涓婏紝RMI榪樻槸浣跨敤浜嗕綘鐨勭綉緇滃爢鏍堝拰TCP/IP鍘昏繘琛岄氳錛屽茍涓旀槸榪愯鍦ㄤ笁涓笉鍚岀殑Java铏氭嫙鏈轟笂銆傝繖宸茬粡鏄竴涓畬鏁寸殑RMI緋葷粺銆?/p>

涔濆疂 2011-02-13 18:46 鍙戣〃璇勮
]]>JavaBean PropertyChange 涔嬭璁℃ā寮廜bserver(杞?http://www.tkk7.com/yglwxl/archive/2011/02/13/344201.html涔濆疂涔濆疂Sun, 13 Feb 2011 10:26:00 GMThttp://www.tkk7.com/yglwxl/archive/2011/02/13/344201.htmlhttp://www.tkk7.com/yglwxl/comments/344201.htmlhttp://www.tkk7.com/yglwxl/archive/2011/02/13/344201.html#Feedback0http://www.tkk7.com/yglwxl/comments/commentRss/344201.htmlhttp://www.tkk7.com/yglwxl/services/trackbacks/344201.html闃呰鍏ㄦ枃

涔濆疂 2011-02-13 18:26 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 粉色视频成年免费人15次| 国产成人免费高清激情视频| 亚洲国产精品无码久久九九大片 | 亚洲国产成人久久一区WWW| 免费看h片的网站| 亚洲精品黄色视频在线观看免费资源| 亚洲一区二区三区高清视频| 亚洲AV无码成人精品区天堂| 亚洲免费视频一区二区三区| 日本高清免费不卡视频| 精品香蕉在线观看免费| 日本免费中文字幕| 成年女人A毛片免费视频| 国产综合激情在线亚洲第一页| 中文字幕在线观看亚洲视频| 亚洲国产成人久久精品影视| 日韩精品无码免费视频| 亚洲中文字幕精品久久| 亚洲国产午夜电影在线入口| 久久久久亚洲AV无码永不| 亚洲av无码精品网站| 国产亚洲综合网曝门系列| 亚洲熟女乱综合一区二区| 亚洲av无码天堂一区二区三区 | 精品亚洲成A人在线观看青青| 亚洲黄色激情视频| 亚洲啪啪免费视频| 亚洲午夜精品一区二区公牛电影院 | 亚洲国产成人久久综合一| 亚洲爆乳精品无码一区二区三区 | 亚洲另类自拍丝袜第五页| 亚洲粉嫩美白在线| 亚洲一线产品二线产品| 亚洲va久久久久| 亚洲精品伦理熟女国产一区二区| 国产亚洲精品VA片在线播放| 亚洲欧美国产日韩av野草社区| 亚洲色大情网站www| 相泽南亚洲一区二区在线播放| 国产亚洲人成在线影院| 国产大片免费天天看|