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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:42:05+00:00 2026-06-03T15:42:05+00:00

Hi I had an authentication service which works on Request (some Header-Data and Cookie),

  • 0

Hi I had an authentication service which works on Request (some Header-Data and Cookie), Response (to set or delete a cookie) and session (Store userId and rememberMe-information).

In play 1.x it was easy to fake Request, Response, Cookie and Session. It could be easily set with Session.current().set(new Session()). In play 2.0 this doesn’t work anymore.

How can I add a cookie to a request? How could I manipulate the session? I saw there exists FakeApplication and FakeRequest but I didn’t get it, how to work with them.

Any hint is appreciated.

  • 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-06-03T15:42:07+00:00Added an answer on June 3, 2026 at 3:42 pm

    It’s possible to do it similar to play1.x. The central point is the Context. Furthermore you must create a DummyRequest which implements the methods you need. Then it’s possible to create the following

    final Request request = new DummyRequest();
    Context.current.set(new Context(request, new HashMap <String, String>(), 
            new HashMap <String, String>()));
    

    in your test you can get Context.current().session(), Context.current().response() or Context.current().request().

    You can see here an test-example.

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

Sidebar

Related Questions

I was looking at an authentication system which had this code: # prevents a
An authentication service allows user accounts be disabled (a sort of soft-delete). If the
I have had some problems with authentication in ASP.NET. I'm not used most of
I'm using spring MVC, and I have a custom authentication/security system that I had
I've inherited a BizTalk 2006 application that uses several SOAP ports to request data
I'm preparing to create a WCF Service which our customers can use to update
For a RESTful web service we say that that the server shouldn't store any
I've had to replace the session token handler with the following, due to a
I am implementing a basic authentication WCF service in ASP.NET using Visual Studio 2010.
Had a page that was working fine. Only change I made was to add

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.