Computer Knowledge

Java Enterprise and Web Technologies

2,279 Questions

Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.

HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts

Java Enterprise and Web Technologies Questions

Multiple choice technology security
  1. Log Message which gets logged in the log file and not safe to display to users

  2. User Message which is safe to display to users

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

EnterpriseSecurityException contains two types of messages - a log message for developers/sysadmins that may contain sensitive details, and a user message that is safe for end users. This separation prevents information leakage.

Multiple choice technology security
  1. LoginException

  2. EnterpriseSecurityException

  3. SecurityException

  4. IntrusionException

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The login() method handles user authentication and can fail for various reasons (invalid credentials, locked account, etc.). When authentication fails, it throws a SecurityException, which is the appropriate exception type for security-related failures in the API hierarchy.

Multiple choice technology security
  1. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response)

  2. void setNoCacheHeaders(javax.servlet.http.HttpServletRequest request)

  3. boolean setNoCacheHeader(javax.servlet.http.HttpServletResponse response)

  4. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The correct method signature uses HttpServletResponse as the parameter since caching headers are set on the response object. The method is void because it performs an action (setting headers) rather than returning a value. Option B incorrectly uses HttpServletRequest, and options C and D have incorrect return types or exception declarations.

Multiple choice technology security
  1. encryptHiddenField(java.lang.String value)

  2. addCSRFToken(final java.lang.String href)

  3. verifySecureComm(javax.servlet.http.HttpServletRequest request)

  4. setSafeContentType(javax.servlet.http.HttpServletResponse response)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Cross Site Request Forgery (CSRF) prevention requires adding unpredictable tokens to requests that the server can verify. The addCSRFToken method is specifically designed for this purpose. Option A (encryption) and C (secure communication verification) address different security concerns, while D (content type) is about XSS prevention.

Multiple choice technology security
  1. It checks if the http request is made on an SSL channel

  2. It checks if the http method is a POST

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The isSecureRequest method performs two critical security checks: verifying SSL usage (HTTPS) and ensuring the HTTP method is POST. POST over HTTPS provides confidentiality and is the standard for secure form submissions. Options A and B are each partially correct but incomplete.

Multiple choice technology security
  1. Log Message which gets logged in the log file and not safe to display to users

  2. User Message which is safe to display to users

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

EnterpriseSecurityException contains two types of messages: a log message for developers/system administrators and a user message safe for display. This separation prevents exposing sensitive technical details to end users while maintaining audit trails. Options A and B are each partially correct.

Multiple choice technology security
  1. LoginException

  2. EnterpriseSecurityException

  3. SecurityException

  4. IntrusionException

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The login method throws SecurityException when authentication fails or security violations occur during the login process. This is a standard exception type for security-related failures in Java security APIs, providing a clear indication of security-related issues.

Multiple choice technology security
  1. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response)

  2. void setNoCacheHeaders(javax.servlet.http.HttpServletRequest request)

  3. boolean setNoCacheHeader(javax.servlet.http.HttpServletResponse response)

  4. void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Cache control headers must be set on the HttpServletResponse object, not the HttpServletRequest. The method returns void as it performs an action (setting headers) rather than returning a value. ServletException is not relevant to header operations, making option A the correct signature.

Multiple choice technology security
  1. encryptHiddenField(java.lang.String value)

  2. addCSRFToken(final java.lang.String href)

  3. verifySecureComm(javax.servlet.http.HttpServletRequest request)

  4. setSafeContentType(javax.servlet.http.HttpServletResponse response)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Preventing Cross Site Request Forgery requires associating requests with a unique, unpredictable, and user-specific token. The addCSRFToken method appends this token to URLs, verifying that the request originated from the authenticated user rather than an external site.

Multiple choice technology security
  1. It checks if the http request is made on an SSL channel

  2. It checks if the http method is a POST

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The isSecureRequest method performs comprehensive security validation by checking both if the request uses HTTPS (SSL/TLS encrypted channel) and if it's a POST method. This dual verification ensures sensitive operations only proceed over secure connections with appropriate HTTP methods.

Multiple choice technology security
  1. Log Message which gets logged in the log file and not safe to display to users

  2. User Message which is safe to display to users

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

EnterpriseSecurityException maintains two separate messages: a log message containing technical details for developers (written to log files, not shown to users) and a user message with sanitized, safe information appropriate for display to end users without exposing sensitive system details.

Multiple choice technology security
  1. Add the domain name in the “Additional servers and domains” section in the scan configuration

  2. Add 10.1.52.3 in the “Additional servers and domains” section in the scan configuration

  3. Put the domain name in the login url

  4. Change the application code to reflect the domain name every where

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

When part of the app uses a domain name but login uses IP (10.1.52.3), AppScan needs to know about both to test the complete application. Adding the domain to 'Additional servers and domains' allows AppScan to follow links and test all parts. Adding only the IP or changing code are incorrect approaches.

Multiple choice technology security
  1. Cross site request forgery

  2. Cross site scripting

  3. HTTP Response Splitting

  4. SQL injection

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The injected payload contains %0d%0a (CRLF - carriage return + line feed) used to split HTTP responses. AppScan tests for HTTP Response Splitting by injecting these characters to attempt injecting arbitrary headers or splitting the response body. This can lead to cache poisoning, XSS, or other attacks. CRLF injection is the key indicator.

Multiple choice technology security

For a given url -> http://www.example.com/smb.jsp&page=wireless where wireless indicates a unique page how would you configure appscan to test all unique pages?

  1. Ignore the page parameter

  2. Track the page parameter

  3. Set the redundant path limit to 1

  4. Set the depth limit to 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Parameter tracking ensures AppScan tests each unique page value separately. If you ignore or limit it, AppScan might only test one value and miss vulnerabilities on other pages.