Hi carlossierra,
that's great to hear.
Best regards
Blama
Announcement
Collapse
No announcement yet.
X
-
Blama, sorry for not getting back to you before (it was a holiday weekend here in Colombia). I confirm that your suggested approach is just what I was needing. Thanks for helping me out!!
Leave a comment:
-
Hi carlossierra,
please see this thread, where DSRequest.setRequestContext() is explained a bit.
See this thread for Servlet + DMI validation with l10n, which works in releases newer than March, 24th (see post #4 from Isomorphic).
My servlet code looks like this:
Very top of doGet()/doPost() (only once, see here):
Code:RequestContext receiveMailRequestContext = RequestContext.instance(this, servletRequest, servletResponse);
Code:dsRequest.setRequestContext(requestContext);
Code:public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager, DSTransaction dsTransaction, Long userID, RequestContext requestContext) throws Exception { if (rpcManager != null) { dsRequest.setRPCManager(rpcManager); } else { prepareRequest(dsRequest, requestContext); if (dsTransaction != null) { dsRequest.setDSTransaction(dsTransaction); if (userID != null && dsTransaction.getUserId() == null) { dsTransaction.setUserId(userID.toString()); dsTransaction.setClientRequest(false); } } else if (dsTransaction == null) { if (userID != null) { dsRequest.setUserId(userID.toString()); dsRequest.setClientRequest(false); } } } } public static void prepareRequest(DSRequest dsRequest, DSTransaction dsTransaction, Long userID, RequestContext requestContext) throws Exception { prepareRequest(dsRequest, null, dsTransaction, userID, requestContext); } public static void prepareRequest(DSRequest dsRequest, Long userID, RequestContext requestContext) throws Exception { prepareRequest(dsRequest, null, null, userID, requestContext); } public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager) throws Exception { prepareRequest(dsRequest, rpcManager, null, null, null); } public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager, DSTransaction dsTransaction) throws Exception { prepareRequest(dsRequest, rpcManager, dsTransaction, null, null); } public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager, DSTransaction dsTransaction, RequestContext requestContext) throws Exception { prepareRequest(dsRequest, rpcManager, dsTransaction, null, requestContext); } public static void prepareRequest(DSRequest dsRequest, DSRequest parentDSRequest) throws Exception { prepareRequest(dsRequest, parentDSRequest.getRPCManager(), parentDSRequest.getDsTransaction(), Long.getLong(parentDSRequest.getUserId()), parentDSRequest.getRequestContext()); } public static void prepareRequest(DSRequest dsRequest, RequestContext requestContext) { dsRequest.setRequestContext(requestContext); }
For me, I have to fake the language for the user I'm sending a mail to in my case using a language value I safe in the DB for every user.
Assuming you servlet is hit by the user, handing down the RequestContext should be enough.
Best regards
Blama
Leave a comment:
-
Yes. Will come back to you on Monday.
Or look at my threads from the last 2 months and Isomorphic's answers. It's there with "use xyz once". Sth like ServletRequest.getInstance(), from the SmartGWT classes.
Leave a comment:
-
-
Hi carlossierra,
are you talking about clientless requests (started by a servlet) or some additional requests inside a DMI that gets called by user interaction.
If the latter, just giving using the original RPCManager (dsRequest.getRPCManager()) in the new DSRequest's constructor should be enough.
This will use the same locale detection mechanisms like the one for GWT permutation selection (http request header accept language).
Best regards
Blama
Leave a comment:
-
Localized Error Messages for Server Side DSRequest
Hi Isomorphic. Is there any way to set the actionUrl for a server DSRequest, like it it possible for a client DSRequest?
I need to do this (I think) so that I can specify the locale explicitly, in order to get my server side requests to return validation messages in the user's locale. These requests are created to perform some DataSource.OP_ADD operations, and the localized messages are important so that I can tell the user what failed in the process, in case of errors.
This is what I am trying to use, since I didn't find a setActionUrl method, but with no success:
Code:DSRequest.setAttribute("actionUrl", "http://localhost:8081/MyApp/myapp/sc/IDACall?locale=es");
Is this the right approach to try and localize the messages from my server side DSRequests?
By the way, I am using 6.0p 2016-04-12.
ThanksLast edited by carlossierra; 6 May 2016, 15:28.Tags: None
Leave a comment: