Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7157871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T12:57:53+00:00 2026-05-28T12:57:53+00:00

I am a little confused about the various methods’ implementations. Actually, I was Learning

  • 0

I am a little confused about the various methods’ implementations.
Actually, I was Learning Servlet and JSP and I found many methods like

request.getSession(); 
response.getWriter();

so please, can any one tell me where (In which class) the implementation of the methods (getSession(), getWriter(), etc) are present?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T12:57:56+00:00Added an answer on May 28, 2026 at 12:57 pm

    They are present in the servletcontainer itself. Even more, the servletcontainer is at its own actually the whole concrete implementation of the Servlet API.

    In case of Tomcat (which is open source), the implementation of request.getSession() is provided by the org.apache.catalina.connector.Request class. In the current Tomcat 7.0.25 release it look like this:

    2288    @Override
    2289    public HttpSession getSession() {
    2290        Session session = doGetSession(true);
    2291        if (session == null) {
    2292            return null;
    2293        }
    2294
    2295        return session.getSession();
    2296    }
    

    Equivalently, the response.getWriter() implementation is provided by org.apache.catalina.connector.Response class which look like this in Tomcat 7.0.25:

    628    @Override
    629    public PrintWriter getWriter()
    630        throws IOException {
    631
    632        if (usingOutputStream) {
    633            throw new IllegalStateException
    634                (sm.getString("coyoteResponse.getWriter.ise"));
    635        }
    636
    637        if (ENFORCE_ENCODING_IN_GET_WRITER) {
    638            /*
    639             * If the response's character encoding has not been specified as
    640             * described in <code>getCharacterEncoding</code> (i.e., the method
    641             * just returns the default value <code>ISO-8859-1</code>),
    642             * <code>getWriter</code> updates it to <code>ISO-8859-1</code>
    643             * (with the effect that a subsequent call to getContentType() will
    644             * include a charset=ISO-8859-1 component which will also be
    645             * reflected in the Content-Type response header, thereby satisfying
    646             * the Servlet spec requirement that containers must communicate the
    647             * character encoding used for the servlet response's writer to the
    648             * client).
    649             */
    650            setCharacterEncoding(getCharacterEncoding());
    651        }
    652
    653        usingWriter = true;
    654        outputBuffer.checkConverter();
    655        if (writer == null) {
    656            writer = new CoyoteWriter(outputBuffer);
    657        }
    658        return writer;
    659
    660    }
    

    So has each other servletcontainer/appserver (Glassfish, JBoss AS, Jetty, WebLogic, WebSphere AS, etc) its own implementation (although they mostly use a fork of Tomcat).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a little confused about HTML classes and IDs, as I'd like to use
I'm a little confused about what is going on in Perl constructors. I found
I'm a little confused about how C++ handles includes. I have something like: typedef
I'm a little confused about MongoDB's read locking. How many concurrent read operations can
I am little confused about setting events in .NET. I have methods that is
I'm a little confused about the principles of autoreleasing objects from custom init methods.
I'm a little confused about clustering with gproc as a pubsub. I would like
I`m a little confused about this point. Everything that I found in books, blogs,
I'm a little confused about how the standard library will behave now that Python
I am a little confused about how I set and get the instance variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.