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 888239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:21:51+00:00 2026-05-15T13:21:51+00:00

I wrote a RESTful servlet, and the UI developer wants to save the logged-in

  • 0

I wrote a RESTful servlet, and the UI developer wants to save the logged-in state on the server.

He made this strange claim: “I haven’t encountered a production REST implementation that is pure REST. The ones I’ve seen all have had the server maintain a session.”

I find this difficult to accept. First there’s the technicality that there are plenty of plain HTTP pages out there, all purely RESTful. Second, yes, there are non-RESTful implementations labeled RESTful, just like there’s brass labeled “gold”. Third, just because everyone else jumps off a bridge doesn’t mean I should.

Background: It’s a JavaScript Ajax web application using HTTPS and Basic authentication. To avoid the usual (uncustomizeable) browser login popup box, the application shows a login screen with the product logo and text boxes for name and password. The name and password are stored in the document and sent in the Authorization header for each request. If you refresh the page, the name and password are lost and the user must type them in again. That’s considered a bug; the UI developer wants to be able to press the refresh button without giving the password again.

So the developer wants to use a cookie or a JSP session. Abby, is it true that in the end every REST implementation maintains application state on the server? Or is there a way I can solve this problem and still maintain my RESTful purity?

  • 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-15T13:21:52+00:00Added an answer on May 15, 2026 at 1:21 pm

    I think that for practical reasons (mainly browsable abilities) you need to distinguish between application state and authentication state. I can’t think of any authentication mechanism that doesn’t retain some form of state on the server side.

    What really matters is how decoupled it is from the application. For example, HTTP Digest retains some form of state on the server, but this is clearly abstracted away as part of the normal WWW-Authenticate and Authorization header negotiation. Because most browsers support it natively, this is orthogonal to the application and as such doesn’t break the statelessness principle of REST.

    Nowadays, because users have some aesthetic expectations that HTTP Basic/Digest authentication don’t meet in the browsers, websites tend to use form-based authentication and subsequently cookies. To be fair it’s more than just the way it looks, it also a matter of usability (e.g. “forgotten your password” information, although that could be in the body of a 401 response) and security. Browsers don’t let you log off from Basic/Digest/Certificate authentication easily, unless it’s done entirely in Ajax within a single page, as you’ve mentioned, and that can help CSRFs.

    I think cookies are acceptable for authentication, but make sure you don’t store application-related variables in the session.

    You can read some of Roy Fielding’s comments on the topic:

    Authentication is orthogonal. Cookies
    are also orthogonal when they are
    simply used for content negotiation or
    authentication. However, Cookie
    authentication is not allowed in REST
    because it lacks visibility, which
    causes security problems because the
    other components don’t know it is
    sensitive information.

    EDIT (further comments on the security aspects):

    I realise Roy Fielding’s comments in the message I’ve quoted is against cookies for security reasons. He’s right of course. However, in my opinion, it’s harder to protect against CSRF via Basic/Digest/Cert (which wasn’t really on the radar in 2003, date of that message) than against cookie theft. It depends on the implementation of course. There isn’t a perfect solution, but if you use cookies, use secure cookies, over HTTPS.

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

Sidebar

Related Questions

I m using FALCON semantic search engine RESTful API & wrote this program But
I wrote this, and wanted to get everyones opinion. I use this when I'm
I wrote this script to first install the msi and then copy my application
I'm developing a RESTful API and I wrote a mod_perl2 handler that takes care
I read Bill Burkes book Restful Java with JAX-RS (2009) and when he wrote
I'm writing a RESTful Java server with CXF framework. How do I can write
I recently wrote another post on this same topic in which I was not
I have an embedded application which communicates with a RESTful server over HTTP. Some
I just installed Restful Authentication. After someone has successfully logged in, they write a
Sorry, this questions sounds silly, but after developing some of my RESTful services using

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.