Java EE 7 Application Developer flashcards
Java EE 7 Application Developer · Build recall with a focused review session.
32 cards. Read the term and the definition here. The deck at the top of this page is optional.
- Web Profile contents
- The Java EE 7 Web Profile includes Servlet, JSP, JSF, CDI, EJB Lite, JPA, Bean Validation, JTA, and JAX-RS. It excludes JMS, JAX-WS, JCA, and full EJB features such as message-driven beans and timers.
- EAR/lib visibility
- Libraries placed in the EAR lib directory are visible to all modules in the application. Modules otherwise do not see each other's classes unless declared through the Class-Path manifest entry.
- metadata-complete attribute
- Setting metadata-complete=true in web.xml or ejb-jar.xml disables annotation scanning for that module. Deployment descriptor settings then fully define the module's configuration.
- bean-discovery-mode
- The beans.xml attribute bean-discovery-mode accepts annotated or all. Annotated discovers only beans with bean-defining annotations; all discovers every eligible class. Absent beans.xml means no CDI discovery in Java EE 7.
- Servlet 3.1 async support
- Asynchronous processing starts with request.startAsync(), returning AsyncContext. The target servlet and all filters must declare async-supported true, otherwise startAsync throws IllegalStateException.
- Forward versus redirect
- RequestDispatcher.forward keeps the same request and response objects and the browser URL unchanged. sendRedirect sends a new client request with a new URL and loses request attributes.
- JSP static versus dynamic include
- The include directive merges the included file at translation time into one servlet. The jsp:include action invokes the resource at request time and merges its output.
- HttpSession invalidation
- Calling HttpSession.invalidate() discards the session and its attributes. A subsequent getSession() creates a new session; getSession(false) returns null when none exists.
- JSF immediate attribute
- Setting immediate=true on an input or command component processes it during Apply Request Values, skipping validation and model update. It is used for cancel buttons and partial processing.
- Facelets template tags
- ui:composition defines a template client, ui:define supplies content for a named slot, and ui:insert declares a slot in the template. These tags live in the http://xmlns.jcp.org/jsf/facelets namespace.
- JSF ViewScoped
- A view-scoped bean retains state while the user interacts with the same view, surviving postbacks but not navigation to another view. It requires a postback to remain active.
- f:ajax execute and render
- The execute attribute lists component IDs processed during the request; render lists components whose output is re-rendered. The special values @this, @form, @all, and @none select groups.
- Stateless session bean pooling
- The container pools stateless session bean instances and may reuse one for different clients across calls. No conversational state is retained between invocations, so instance fields must not hold client data.
- EJB transaction attribute REQUIRED
- REQUIRED is the default. The method runs in the caller's transaction if one exists; otherwise the container starts a new transaction that commits or rolls back when the method returns.
- CDI producer method
- A producer method annotated @Produces supplies objects to inject, enabling selection of types that cannot be annotated directly. Qualifiers on the producer determine which injection points it satisfies.
- ConversationScoped and Conversation
- Conversation-scoped beans span multiple requests within a bounded unit of work. The bean calls Conversation.begin() to start and end() or timeout to finish the conversation.
- EntityManager persist versus merge
- persist makes a new entity managed and throws EntityExistsException if already managed. merge copies state onto a managed instance and returns that instance; the argument stays detached.
- mappedBy attribute
- mappedBy names the field on the owning side that owns the relationship. The side without mappedBy defines the foreign key column and controls persistence of the association.
- Optimistic locking with Version
- A field annotated @Version is incremented on each update. A conflicting concurrent update raises OptimisticLockException, and the version field must be numeric or a timestamp type.
- JPA fetch type defaults
- @ManyToOne and @OneToOne default to EAGER fetching. @OneToMany and @ManyToMany default to LAZY, meaning the collection loads only when accessed within an active persistence context.
- JAX-RS @PathParam
- @PathParam binds a URI template variable such as {id} in @Path to a method parameter. The value is converted to the parameter type, and a failed conversion produces 404 Not Found.
- JAX-RS Response builder
- Response.ok(entity).type(mediaType).build() creates a 200 response. Response.status(Response.Status.CREATED).entity(e).build() creates a 201 with entity; status can also be an int.
- JAX-RS 2.0 client API
- ClientBuilder.newClient() creates a Client. client.target(uri) returns WebTarget; target.request(mediaType) returns Invocation.Builder, whose get or post methods invoke the service and return Response.
- ExceptionMapper provider
- An ExceptionMapper<T> implementation annotated @Provider converts thrown exceptions into Response objects. It centralizes error handling across resources and can map custom exceptions to HTTP status codes.
- JAX-WS @WebMethod exclude
- @WebMethod(exclude=true) prevents a public method from being exposed as a SOAP operation. Without it, all public methods of a @WebService class become operations in the WSDL.
- JAX-WS Dispatch client
- The Dispatch<T> interface sends and receives raw SOAP messages without a generated proxy, using Service.createDispatch with a port, type, and mode such as PAYLOAD or MESSAGE.
- SOAP handler registration
- SOAP handlers implement SOAPHandler<SOAPMessageContext> and are registered through @HandlerChain referencing an XML file, or in the deployment descriptor. They can inspect and modify messages.
- JAXB XmlAccessorType
- @XmlAccessorType controls whether fields or properties are mapped: FIELD, PROPERTY, PUBLIC_MEMBER, or NONE. It determines the XML schema generated for JAX-WS parameter types.
- Container-managed transaction rollback
- A system exception, such as a RuntimeException, causes the container to roll back the transaction. An application exception rolls back only when annotated @ApplicationException(rollback=true).
- web.xml login-config
- The login-config element sets auth-method to BASIC, FORM, DIGEST, or CLIENT-CERT and names the realm. It works with security-constraint and security-role to enforce declarative authentication.
- Message-driven bean configuration
- An MDB is annotated @MessageDriven with activationConfig properties such as destinationLookup and destinationType. It implements MessageListener, and onMessage runs within a container transaction by default.
- JMS acknowledge modes
- AUTO_ACKNOWLEDGE acknowledges after the receive method returns. CLIENT_ACKNOWLEDGE requires message.acknowledge(). DUPS_OK_ACKNOWLEDGE allows duplicates, and SESSION_TRANSACTED groups receives into a transaction.