I have a spring webflow application which is siteminder protected. The url typically has some params which the app uses to execute it's functionality. The implementation details are as follows -
When the url is invoked, i have an initial flow called authorize which takes the request params and validates them, If everything is good i have all the params in a javabean and this bean is stored in 'flowscope'
The above bean is passed to the next flows for various actions
This works fine when the url is invoked from the browser, but when the url is invoked from a word document we get the authentication dialog twice but the url params are not passed over to the browser.
Any one faced similar issue - please let me know
Thanks in advance.
Regards,
Kiran C Sagi.
Related
I have just started with Spring Web Flow. I have a basic doubt. In case of Spring MVC, the #RequestMapping contains the URL mapping, say for eg, #RequestMapping("/home"), this means, when the URL nodeContent is /home, the Contorller with #RequestMapping("/home") will be delegated by the dispatcher servlet. In case of Spring Web Flow, how is this mapping done? I mean, how do we even identify the request URL? is it the flow-location id in flow-registry? Basically, I want to know how to identify that when a Spring web flow is invoked based on what kind of URL request? eq- "https://stackoverflow.com/questions/ask", if this URL has to invoke a flow, how is the mapping done with the URL /ask.
Please can anyone answer this?
The main thinks is, there are two beans which is complete the mapping.
First of all,
FlowHandlerMapping : in general, DispatcherServlet know the request mapping by handler mapping, but in WebFlow, FlowHandlerMapping helps DispathcerServlet to know the mapping. Basically it's "flow-registry". When hit the url, then it's get the url with the id. now it's ready to execute the flow.
FlowHandlerAdapter : When the executable flow url is ready then it's try to load the flow file with id like
configure-flow.xml
Once you successfully get the path then flow will start. The flow will continue until view-state to end-state.
Maintain the order of your view page, because next flow will come in order.
If you have any question, leave in comment section.
I am developing an application that will serve multiple customer-organizations, each of them should be given access based on a fixed url. Example: domain/myapp/CustomerOrg1
Previously I always registered a new WAComponent-subclass for each of these entry-points. That does work but there has to be a better solution, I would like a single component-class to find out which URL the request uses (to then respond with the customer-org's homepage)
I tried:
registering a WARequestHandler-subclass; and it allows me to find out the full path (incl. /CustomerOrg1) but I am outside of any session and don't know how to get into one.
registering a WAComponent-subclass as /myapp, and it works in that it also handles /myapp/CustomerOrg1 automatically, however when I try to find out the URL used (by self session url inspect) it claims to be only the base-url (/myapp).
Try
self requestContext request uri
and if you are not in a component but any object you can do
WACurrentRequestContext value request uri
Please be aware that the uri you get in the answer by Norbert is in a production environment a value that has already been processed, and possibly modified, by your (Apache/nginx/etc) webserver responsible for static content and load balancing.
I have an asp.net application that I'm attempting convert the front end to Angular. Getting header information is important to the view. I'm used to getting the header information like so in C#:
httpContext.Request.Headers["USERID"]
How can I do the same thing in an angular controller?
In asp.net each request runs in its own independent context and hence the header access as you have shown in your code make sense.
This does not hold good for angular or in fact any client side framework. You can always get the headers for any request or response made using angular $http but the question is which request? During the lifetime of the app you would make many such requests.
Let's say you want to get the current userid, you can create a service that returns the logged in user. There are two ways to implement such a sevice
create a method on server to return this data. Invoke this method from service and cache results
on the client side assuming there is a login request made through angular, implement a success callback method which can update the service with the logged user id.
You can look at $http documentation here to understand how to access headers.
We have a need to make a call to a servlet from an external application which is making a post request.
The servlet looks at the request, performs some processing and sets a attribute on the request or session and redirects to a JSF page which needs to retrieve the attribute set on the request or the session and do additional stuff.
For both cases I have been unable to retrieve the attribute/parameter set on the session or request from the managed bean and upon further debugging, it revealed that the session ids were different in servlet and in the managed bean.
Since this is a request coming from an external application, there is no session in the servlet so doing request.getSession(true); which is creating a new session in the servlet.
I was under the understanding that since these were part of the same application and using the same context that they would have the same session. Is my understanding incorrect?
Is there a better solution to this issue? (I did consider creating a Filter but thought might have the same issue with the session)
Any help in understanding better or resolving this issue will be appreciated.
As to how sessions work, carefully read this: How do servlets work? Instantiation, sessions, shared variables and multithreading.
In fact, the external application should have sent the very same session cookie as the JSF application is using. An alternative would have been to provide a callback URL including the jsessionid path fragment, which is composed as follows:
String url = "http://example.com/context/servlet;jsessionid=" + session.getId();
Again another alternative would be to generate an unique ID (with java.util.UUID) referencing an entry in application scope or even the DB and set it as request parameter in the callback URL. You should only manually cleanup it when the session is destroyed. You can use a HTTP session listener for that.
Is there a way to get the server url (ex: http://www.myapp.com:8080/applicationFolder) without having access to a Request object ?
I need the url at aplication_start and in some classes where the Request object with all the goodies is not available.
note: I know that getting the application folder can be done using
VirtualPathUtility.ToAbsolute("~/");
HttpContext.Current.Request is a static property that always returns the Request object currently executing for the session.
I think all you need a custom solution to know when first request is made after application starts, and then you can send any email you want.. this is the similar problem with solution here http://weblogs.asp.net/reganschroder/archive/2008/07/25/iis7-integrated-mode-request-is-not-available-in-this-context-exception-in-application-start.aspx this do first initialization check in BeginRequest event.
There can be many different addresses all pointing to the same ASP.NET website, like using IP address or name. There might be more than 1 DNS name pointing to the same ASP.NET application. Therefore, HttpApplication, the parent class of Global, does not know which URL a visitor will use. Even IIS doesn't know. Therefore, you have to wait for the first request and then check in the request what URL the visitor uses to access your site. Something like this:
string baseUrl = Context.Request.Url.GetLeftPart(UriPartial.Authority);
One has to use Context to get access to the Request during Global.Application_Start, because Global.Request is not initialised yet.