Questions tagged [actioncontext]

The ActionContext is a Struts 2 container for objects needed by the application when the action is executed.

The ActionContext is a Struts 2 container for objects needed by the application when the action is executed. An action context used to access those objects during the the action execution. When Struts2 request is handled by the framework it creates an ActionContext and populate it with the framework core objects, such as request, session, application, valueStack, servlet context objects, parameters, locale, etc. The benefit of this is there's no need to worry about a user specific action context, and it could get statically from the class ActionContext which is ThreadLocal in every request.

References:

66 questions
7
votes
4 answers

Get HttpServletRequest in Struts 2 interceptor

To get the HttpServletRequest in an interceptor I used below code: HttpServletRequest request =(HttpServletRequest) ActionContext.getContext().get(HTTP_REQUEST); I tried to implement ServletRequestAware in the interceptor but it did not worked. Are…
Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
6
votes
2 answers

Should I get the session through SessionAware or ActionContext?

After reading the differences between obtaining the session map via ActionContext.getContext().getSession() and having it injected through SessionAware I was wondering which is the preferred method, and why? The API recomends to use SessionAware,…
user663724
6
votes
1 answer

IActionContextAccessor Is Null

I am setting up a custom Middleware for my .NET Core Application to log exception errors and have the following in the Startup.cs to register my contexts: services.AddHttpContextAccessor(); services.AddSingleton
Zack Antony Bucci
  • 571
  • 1
  • 12
  • 29
6
votes
2 answers

What is the difference between ServletContext and ServletActionContext

Please tell me what is the difference between ServletActionContext and ServletContext? ServletContext is shared among all the servlets and actions, while ServletActionContext is specific to an action or is that also shared among all the actions?
user1147070
  • 491
  • 7
  • 21
5
votes
2 answers

Avoiding access to history after logout

i want to create a login page and after logout i want user to show the login page rather than the previous page how to prevent user from going to back to previous page after logout. i have cleared the cache....but it by pressing back button user is…
coder25
  • 2,363
  • 12
  • 57
  • 104
5
votes
1 answer

Web API: how to read action attribute and parameters from HttpContext

In regular class, I need to read following from the HttpContext: Controller and action name Action's attribute (I could get that through HttpActionContext.ActionDescriptor.GetCustomAttributes() but here I don't have HttpActionContext - I…
4
votes
1 answer

struts2: ActionContext.getContext(); returns null

recently I updated my struts2 version from 2.0.11 to the current 2.2.3. Unfortunately I have curious problems now which I was not able to solve so far. When I try to get the ActionContext: ActionContext context = ActionContext.getContext(); …
oetzi
  • 97
  • 1
  • 6
4
votes
1 answer

ASP.NET Core resolve url in startup?

I would like to be able to register certain url's that take into account actual url of the resources. Specifically: the Swagger end point for my Web API documentation. public void Configure(IApplicationBuilder app, IHostingEnvironment env,…
Sigurd Garshol
  • 1,376
  • 3
  • 15
  • 36
4
votes
1 answer

Struts2 Session Storage Location and Management

I was reading Struts2 In Action, and it says for each request an ActionContext, a ValueStack and an Action instance are created, so they are thread safe. I was wondering how does the framework manages session, because it can't be stored in these…
Udit Mishra
  • 150
  • 11
4
votes
1 answer

ActionContext.getContext().getParameters() returns null during StrutsJUnit4TestCase

I am running a JUnit test via maven where a struts action java method is being tested that makes the following call: // Gets this from the "org.apache.struts2.util.TokenHelper" class in the struts2-core jar String token =…
4
votes
1 answer

How to get an ActionContext from Struts 2 during acceptance tests?

I am writing acceptance tests (testing the behavior) using cucumber-jvm, on an application with Struts 2 and Tomcat as my Servlet Container. At some point in my code, I need to fetch the user from the Struts 2 HttpSession, created by an…
Tarek
  • 3,080
  • 5
  • 38
  • 54
3
votes
2 answers

Struts2 ActionContext and Response for chaining actions

I have a pretty complex problem about struts2 chaining actions, thanks in advance for your patience reading my problem. I will try my best to describe it clearly. Below is my struts.xml:
LiuWenbin_NO.
  • 1,216
  • 1
  • 16
  • 25
3
votes
2 answers

What is the difference between actioncontext and actionInvocation struts2?

I have a little confusion regarding ActionContext and ActionInvocation. I know that Action Context is the context where Action is being executed. Does ActionInvocation lies within ActionContext like Session, Value Stack etc ? Secondly, Does…
Faizan Ahmed
  • 93
  • 2
  • 4
3
votes
2 answers

struts2 i18ninterceptor return to same page or action

I googled 2 hours for my issue but still could'nt find any sollution. What I want to do: I'm using struts2 for an international application so I need multi-language support. Therefor I found the i18n-Interceptor to change the locale with only one…
3
votes
2 answers

Struts2 ActionContext and ValueStack?

My questions are: In Struts2, does every action object have its own corresponding ActionContext and ValueStack? In other words, for every new request a new action object is created. Does this mean every time a new action object is created, a new…
Siva
  • 3,297
  • 7
  • 29
  • 35
1
2 3 4 5