2015년 3월 30일 월요일

About Object Scope Lifecycles.odt





someDay will BE...

notYet!




------------------------------------------------------------------------------------------




25.3 About Object Scope Lifecycles

At runtime, ADF objects such as the binding container and managed beans are instantiated. Each of these objects has a defined lifespan set by its scope attribute. You can access a scope as ajava.util.Map from the RequestContext API. For example, to access an object named foo in the request scope, you would use the expression #{requestScope.foo}.
There are six types of scopes in a Fusion web application:
  • Application scope: The object is available for the duration of the application.
  • Session scope: The object is available for the duration of the session.
Note:
There's no window uniqueness for session scope, all windows in the session share the same session scope instance. If you are concerned about multiple windows being able to access the same object (for example to ensure that managed beans do not conflict across windows), you should use a scope that is window-specific, such as page flow or view scope.
  • Page flow scope: The object is available for the duration of a bounded task flow.
Note:
Because this is not a standard JSF scope, EL expressions must explicitly include the scope to reference bean. For example, to reference the MyBean managed bean from thepageFlowScope scope, your expression would be #{pageFlowScope.MyBean}.
  • Request scope: The object is available from the time an HTTP request is made until a response is sent back to the client.
  • Backing bean scope: Used for managed beans for page fragments and declarative components only, the object is available from the time an HTTP request is made until a response is sent back to the client. This scope is needed for fragments and declarative components because there may be more than one page fragment or declarative component on a page, and to prevent collisions, any values must be kept in separate scope instances. Therefore, any managed bean for a page fragment or declarative component must use backing bean scope.
Note:
Because this is not a standard JSF scope, EL expressions must explicitly include the scope to reference bean. For example, to reference the MyBean managed bean from the backing bean scope, your expression would be #{backingBeanScope.MyBean}.
  • View scope: The object is available until the view ID for the current view activity changes. This scope can be used to hold values for a given page. However, unlike request scope, which can be used to store a value needed from one page to the next, anything stored in view scope will be lost once the view ID changes.
Note:
Both JSF and ADF Faces have an implementation of view scope. Only the ADF Faces view scope survives page redirects and refreshes. In a Fusion web application, when you useviewScope in an expression, it resolves to the ADF Faces view scope.
Because this view scope is not a standard JSF scope, EL expressions must explicitly include the scope to reference bean. For example, to reference the MyBean managed bean from the view scope, your expression would be #{viewScope.MyBean}.
Note:
When you create objects (such as a managed bean) that require you to define a scope, you can set the scope to none, meaning that it will not live within any particular scope, but will instead be instantiated each time it is referenced.
Object scopes are analogous to global and local variable scopes in programming languages. The wider the scope, the higher availability of an object. During their life, these objects may expose certain interfaces, hold information, or pass variables and parameters to other objects. For example, a managed bean defined in session scope will be available for use during multiple page requests. However, a managed bean defined in request scope will only be available for the duration of one page request.
By default, the binding container and the binding objects it contains are defined in session scope. However, the values referenced by value bindings and iterator bindings are undefined between requests and for scalability reasons do not remain in session scope. Therefore, the values that binding objects refer to are valid only during a request in which that binding container has been prepared by the ADF lifecycle. What stays in session scope are only the binding container and binding objects themselves.
Figure 25-4 shows the time period during which each type of scope is valid.
Figure 25-4 Relationship Between Scopes and Page Flow
When determining what scope to register a managed bean with, always try to use the narrowest scope possible. Only use the session scope for information that is relevant to the whole session, such as user or context information. Avoid using session scope to pass values from one task flow to another. When creating a managed bean for a page fragment or a declarative component, you must use backing bean scope.
Managed beans can be registered in either the adfc-config.xml or the configuration file for a specific task flow. For more information about using managed beans in a Fusion application, see Section 24.4, "Using a Managed Bean in a Fusion Web Application."
Note:
Registering managed beans within the faces-config.xml file is not recommended in a Fusion web application.

25.3.1 What You May Need to Know About Object Scopes and Task Flows

When determining what scope to use for variables within a task flow, you should use any of the scope options other than application or session scope. These two scopes will persist objects in memory beyond the life of the task flow and therefore compromise the encapsulation and reusable aspects of a task flow. In addition, application and session scopes may keep objects in memory longer than needed, causing unneeded overhead.
When you need to pass data values between activities within a task flow, you should use page flow scope. View scope is recommended for variables that are needed only within the current view activity, not across view activities. Request scope should be used when the scope does not need to persist longer than the current request. It is the only scope that should be used to store UI component information. Lastly, backing bean scope must be used for backing beans in your task flow if there is a possibility that your task flow will appear in two region components or declarative components on the same page and you would like to achieve region instance isolations.






















객체 범위 라이프 사이클에 대해

실행시에는 그런 바인딩 컨테이너 및 관리 Bean 등의 ADF 객체가 인스턴스화됩니다. 이러한 각 개체는 그 범위의 속성에 의해 설정된 정의 된 수명을 가지고 있습니다. 당신처럼 범위에 액세스 할 수있는 java.util.Map에서 RequestContext하는 API. 예를 들어, 명명 된 개체에 액세스하기 위해 foo는 요청 범위는 당신이 표현 사용합니다 # {requestScope.foo}.

Fusion Web 응용 프로그램의 범위의 6 종류가 있습니다.

Application 범위 : 개체가 응용 프로그램의 지속 기간에 이용 가능하다.

Session 범위 : 객체는 세션 사이에 이용 가능하다.

주의 :
세션 범위에는 창 고유성 세션의 모든 창을 동일한 세션 범위 인스턴스를 공유하지 않습니다. 당신은 여러 창 같은 개체에 액세스 할 수 걱정스러운 경우는 윈도우 고유의 이러한 페이지 흐름 또는 범위를 표시하는 등의 범위를 사용해야합니다 (예를 들어, 관리 Bean은 창 사이에 충돌하지 않도록).
페이지 플로우 범위 : 개체 바인드 작업 흐름의 기간에 이용 가능하다.

주의 :
이것은 표준 JSF 범위가 아니기 때문에 EL 표현식을 명시 적으로 참조 Bean에 범위를 포함해야합니다. 예를 들어, 참조하는 데 MyBean과에서 관리 Bean PageFlowScope 범위, 당신의 표현은 다음과 같습니다 # {pageFlowScope.MyBean}
Request 범위 : 응답이 클라이언트에 전송 될 때까지 객체는 HTTP 요청이 이루어진 시점에서 입수 가능하다.

백업 Bean 범위 : 페이지 단편 선언 구성 요소의 관리 Bean에서 사용뿐만 객체가 응답을 클라이언트로 전송 될 때까지 HTTP 요청이 이루어진 시점에서 사용할 수 있습니다. 거기에 페이지에 여러 페이지 조각 또는 선언 구성 요소 일 수있다, 그리고 충돌을 방지하기 위해 모든 값이 다른 범위 인스턴스에 유지해야하므로이 범위는 조각과 선언 구성 요소 을 위해 필요로된다. 따라서 페이지 조각 또는 선언 구성 요소의 모든 관리 Bean은 백업 Bean 범위를 사용해야합니다.

주의 :
이것은 표준 JSF 범위가 아니기 때문에 EL 표현식을 명시 적으로 참조 Bean에 범위를 포함해야합니다. 예를 들어, 참조하는 데 MyBean는 백업 Bean 범위에서 Bean을 관리하고 당신의 표현은 다음과 같습니다 # {backingBeanScope.MyBean}
뷰 범위 : 개체가 현재 뷰 활동의 변화를위한 뷰 ID로 사용할 수 있습니다. 이 범위는 특정 페이지의 값을 유지하는 데 사용할 수있다. 그러나 다음 페이지에 필요한 값을 저장하는 데 사용할 수있는 요구 범위와 달리 뷰 범위에 포함되는 것으로는보기 ID가 변경되면 손실됩니다.

주의 :
JSF ADF Faces 모두보기 범위의 구현을 가지고있다. 유일한 ADF Faces는 범위는 페이지 리디렉션 및 재생을 살아 본다. 당신이 사용하는 경우 Fusion Web 응용 프로그램은 viewScope를 식에서 그것은 ADF Faces에 해결 범위를 표시합니다.
이 뷰의 범위는 표준 JSF 범위가 아니기 때문에 EL 표현식을 명시 적으로 참조 Bean에 범위를 포함해야합니다. 예를 들어, 참조하는 데 MyBean는 뷰의 범위에서 Bean을 관리하고 당신의 표현은 다음과 같습니다 # {viewScope.MyBean}

주의 :
당신은 범위를 정의해야 (그런 관리 Bean )의 개체를 만들 때 범위를 설정할 수 없슴 그것이 특정 범위 내에서 살아갈 수 없다는 것을 의미,의 대신 그것을 참조 될 때마다 인스턴스화됩니다.
개체의 범위는 프로그래밍 언어의 글로벌 및 로컬 변수의 범위에 유사하다. 개체의 고 가용성 범위도 넓다. 그들의 삶 사이에 이러한 객체는 특정 인터페이스를 노출 정보를 보유하거나 다른 개체에 변수와 매개 변수를 전달할 수 있습니다. 예를 들어, 세션 범위에 정의 된 관리 Bean은 여러 페이지 요청시 사용하실 수 있습니다. 그러나 요청 범위에서 정의 된 관리 Bean은 하나의 페이지 요청 기간 동안 사용할 수 있습니다.

기본적으로 바인딩 컨테이너와 거기에 포함되는 바인딩 객체는 세션 범위에 정의되어 있습니다. 그러나 값이 값 바인딩과 이터레이터 바인딩에서 참조되는에 요청 사이와 세션 범위에 남아 있지 않은 확장 성을 이유로 정의되어 있지 않습니다. 따라서 바인딩 개체 참조 값은 그 바인딩 컨테이너가 ADF 라이프 사이클에 의해 준비된 요청 동안에 만 유효합니다. 어떤 세션 범위에 머물에만 바인딩 컨테이너와 바인딩 개체 자체이다.

그림 25-4은 범위의 각 유형이 유효한 기간을 나타내고있다.

범위 및 페이지 흐름 사이의 그림 25-4의 관계

ADF 라이프 사이클의 범위
에서 관리 Bean을 등록하는 무엇 범위를 결정할 때 항상 가능한 좁은 범위를 사용하도록하십시오. 유일한 그런 사용자와 문맥 정보로 전체 세션 관련 정보는 세션 범위를 사용합니다. 다른 작업 흐름에서 값을 전달하기 위해 세션 범위를 사용하지 마십시오. 페이지 조각 또는 선언 구성 요소의 관리 Bean을 만들 때, 배킹 Bean의 범위를 사용해야합니다.

관리 Bean은 어느 등록 할 수 ADFC-config.xml에 또는 특정 작업 흐름의 설정 파일. Fusion 응용 프로그램 관리 Bean을 사용하는 방법에 대한 자세한 내용은 "Fusion Web 응용 프로그램의 관리 Bean 사용"섹션 24.4

주의 :
내에서 관리 콩 등록 faces-config.xml의 파일은 Fusion Web 응용 프로그램에 권장되지 않습니다.
25.3.1 개체 범위 및 작업 흐름에 관한 필요한 지식

작업 흐름의 변수에 사용하는 어떤 범위를 결정할 때는 응용 프로그램이나 세션 범위 이외의 범위 옵션 중 하나를 사용해야합니다. 이 두 범위는 작업 흐름의 생활을 넘는 메모리의 개체를 유지하기 위해 작업 흐름의 캡슐화 및 재사용 측면을 위태롭게합니다. 또한 응용 프로그램 및 세션 범위는 불필요한 오버 헤드를 일으킬 필요 이상으로 오랫동안 메모리에서 개체를 유지할 수있다.


작업 흐름의 활동간에 데이터 값을 전달해야하는 경우 페이지 플로우 스코프를 사용해야합니다. 뷰 범위는 현재보기 활동 중이 아닌 뷰 활동 사이에서 필요로되는 변수를 권장합니다. 범위가 현재의 요구보다 오래 지속 할 필요가없는 경우에는 요청 범위를 사용해야합니다. 이것은 UI 구성 요소의 정보를 저장하는 데 사용될 유일한 범위이다. 마지막으로, 백업 Bean의 범위는 당신의 작업 흐름은 같은 페이지에 2 지역 구성 요소 또는 선언 구성 요소에 표시되고 당신이 지역 인스턴스 절연을 실현하고자 가능성이있는 경우에는 작업 흐름에 콩 를 백업하는 데 사용해야합니다.



---------------------------------------------------------------

from - https://docs.oracle.com/cd/E16162_01/web.1112/e16182/adf_lifecycle.htm#ADFFD22893
           N
           https://translate.google.com/

Thks oracleNgoogle




댓글 없음:

댓글 쓰기