ApiModelProperties can have an AccessMode specified as READ_ONLY, or READ_WRITE. But the default is AUTO.
How does AUTO decide which value it uses?
Related
I init my socket using the following code
Socket:=TmyidHTTP.Create(NIL);
IOHandler:=TIdIOHandlerStack.Create(Socket);
Socket.HandleRedirects:=true;
Socket.AllowCookies:=FALSE;
Socket.ProtocolVersion:=pv1_1;
Socket.HTTPOptions:=Socket.HTTPOptions+[hoKeepOrigProtocol]+[hoNoProtocolErrorException]+[hoWantProtocolErrorContent];
Socket.Request.CustomHeaders.FoldLines:=FALSE;
Socket.Request.CharSet:='utf-8';
Socket.Request.ContentType:='text/txt';
Socket.Request.Accept:='*/*';
// Socket.ReuseSocket:=rsTrue;
Socket.Request.Connection:='keep-alive';
(TmyidHTTP only publishes the protected DoRequest)
but when I look into the protocol I see the following header: charset=ISO-8859-1.
only if I specify the Socket.Request.CharSet:='utf-8'; again before a post, then it works...
any ideas what is resetting the CharSet??
This is happening because:
you are using an older release of Indy 10 1.
you are setting the ContentType property after setting the CharSet property.
you are not specifying a charset attribute value on the ContentType property.
So, in this case, the ContentType property setter is resetting the CharSet property with a default value, instead of preserving the current value.
1 This was already fixed back in July 2019:
Patch for Embarcadero RSP-13703. Updating various ContentType property setters to preserve an existing CharSet property value if it is already set and a new charset attribute is not being specified.
You should update your installed copy of Indy with the latest code from Indy's GitHub repo (or, at least, apply the same fix to your existing copy and then recompile Indy).
Otherwise, you can simply change your code to either:
swap the order of the two property assignments:
Socket.Request.ContentType:='text/txt';
Socket.Request.CharSet:='utf-8';
specify a charset attribute value on the ContentType assignment, which will update the CharSet property accordingly:
Socket.Request.ContentType:='text/txt;charset=utf-8';
I have these language files:
locales/
en-US/
a.yaml
b.yaml
zh-CN/
a.yaml
b.yaml
DA/
a.yaml
b.yaml
set default language:
app.I18n.SetDefault("en-US")
How to set language dynamically according to l parameter:
www.sete.com/xx/xxx?l=en => set en-US
www.sete.com/xx/xxx?l=cn => set zh-CN
www.sete.com/xx/xxx?l=da => set DA
www.sete.com/xx/xxx?l=NotFound => default en-US
In addition, whenI set a language that doesn't exist:
www.sete.com/xx/xxx?l=NotFound
I get an error in response like this:
{
"user": "yaml%!(EXTRA string=Tom....)"
}
So , what should I do to better solve these problems? I tried my best, my English is not good, please help me.....
You can find Iris i18n examples at: https://github.com/kataras/iris/tree/master/_examples/i18n
If the language was not found, then the default language's key will be shown instead unless app.I18N.Strict is true. If the Strict field is false and the default language has no available key for the translation then the app.I18n.DefaultMessageFunc will be fired instead, you can take a look on how to configure what happens if a key does not exist at: https://github.com/kataras/iris/blob/7b6a8f1e26469ab3ae53cfe468d6e5202c75c2a8/_examples/i18n/basic/main.go#L38-L47
I want to add JVM option -Dfile.encoding=UTF-8 in my application.yml file
I tried using spring.mandatory-file-encoding=UTF-8 . But I'm getting the following error :
Type=ERROR,Category=org.springframework.boot.context.FileEncodingApplicationListener,Thread=main,MDC=,Text=System property 'file.encoding' is currently 'Cp1252'. It should be 'UTF-8' (as defined in 'spring.mandatoryFileEncoding')
Type=ERROR,Category=org.springframework.boot.context.FileEncodingApplicationListener,Thread=main,MDC=,Text=Environment variable LANG is 'en_US.UTF-8'. You could use a locale setting that matches encoding='UTF-8'
Type=ERROR,Category=org.springframework.boot.context.FileEncodingApplicationListener,Thread=main,MDC=,Text=Environment variable LC_ALL is 'null'. You could use a locale setting that matches encoding='UTF-8'
FileEncodingApplicationListener :
It halts application startup if the system file encoding does not match an expected value set in the environment. By default has no effect, but if you set {#code spring.mandatory_file_encoding} to the name of a character encoding (e.g. "UTF-8") then this initializer throws an exception when the System property does not equal it.
Click here to read more:
Deleting this property "spring.mandatory-file-encoding=UTF-8" from application.properties file helped me.
But first I've changed settings in IntelijIDEA: File -> Settings -> Editor -> File Encodings form "System default" to UTF-8. May be it affected somehow.
I'm having a weird problem or maybe i failed to understand how Grails i18n mechanism works.
I inserted the following to my index.gsp file:
LocaleContextHolder.locale: '${org.springframework.context.i18n.LocaleContextHolder.locale}'
java.util.Locale.getDefault(): '${java.util.Locale.getDefault()}'
RequestContextUtils.getLocale(request): '${org.springframework.web.servlet.support.RequestContextUtils.getLocale(request)}'
session['SessionLocaleResolver.LOCALE']: '${session['org.springframework.web.servlet.i18n.SessionLocaleResolver.LOCALE']}'
This code snippet should print the Locale, and it does like so:
LocaleContextHolder.locale: 'iw'
java.util.Locale.getDefault(): 'en_US'
RequestContextUtils.getLocale(request): 'iw'
session['SessionLocaleResolver.LOCALE']: ''
The above is my default output when i run the given code snippet.
I tried to understand what exactly affects this variables so i did the next steps:
I changed Chrome's Locale
Settings --> Show advanced settings --> Language and input settings)
I changed my operating system's locale (Windows 7)
Control panel --> Region and language --> Format + Location + System locale
After those changes i rebooted my computer and expected the values of the locale variables to change, but they still remain the same.
I'm aware i can change the Locale with the ?lang parameter & with some code, but i'm interested in letting Grails to decide which Locale to pick.
What exactly affects those variables? how does Grails decide the machine's locale?
15.2 Changing Locales
By default the user locale is detected from the incoming Accept-Language header. However, you can provide users the capability to switch locales by simply passing a parameter called lang to Grails as a request parameter:
/book/list?lang=es
Grails will automatically switch the user's locale and store it in a cookie so subsequent requests will have the new header.
from here :
https://grails.github.io/grails-doc/2.4.3/guide/i18n.html
If you are deploying in tomcat you can set the locale in the catalina.sh script:
if [ -z "$LOGGING_MANAGER" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Duser.language=en -Duser.region=US"
else
JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER -Duser.language=en -Duser.region=US"
fi
I think the internationalization works when you pass lang parameter in the URL. It's mentioned in the documentation
By default the user locale is detected from the incoming Accept-Language header.
However, you can provide users the capability to switch locales by simply passing
a parameter called lang to Grails as a request parameter:
/book/list?lang=es
http://grails.github.io/grails-doc/latest/guide/i18n.html
By default the user Locale is detected from the incoming Accept-Language HTTP header, this header is generated by the browser that is used by the user.
Each browser determines the system Locale differently:
Internet Explorer uses the O/S Locale settings.
Firefox / Chrome let the user to decide what Locale to use (In the language settings).
See: http://www.w3.org/International/questions/qa-lang-priorities.en.php
I used Jaspersoft iReport Designer 5.1.0 in ubntu 12.04
I want create Hyperlink.
Two Report :- Report 1
Report 2
In Report 1 set Hyperlink To called Report 2
Step :-
Take on text element ex : ${ID}
Right Click Hyperlink
Target : self type : Report Execution
Link Parameter :- _report "/path Report2"
In Preview Click Id than nothing happen and Report 2 not called
And Following Error Occurred:-
Compiling to file... /home/mansi/Tweet_Report/report5.jasper
Compilation running time: 174!
Filling report...
Locale: English (India) Time zone: Default Report fill running
time: 44! (pages generated: 1) Exporting Text (iReport) to file...
/home/abc/R1_Report/Report1.txt!
Error exporting print... net.sf.jasperreports.engine.JRPrintText.getTextAlignment()B
java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JRPrintText.getTextAlignment()B
at com.jaspersoft.jrx.export.JRTxtExporter.layoutGrid(JRTxtExporter.java:419)
at com.jaspersoft.jrx.export.JRTxtExporter.exportPage(JRTxtExporter.java:300)
at com.jaspersoft.jrx.export.JRTxtExporter.exportReportToWriter(JRTxtExporter.java:289)
at com.jaspersoft.jrx.export.JRTxtExporter.exportReport(JRTxtExporter.java:257)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1174)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Export running time: 9! No external viewer specified for this type of
print. Set it in the options frame!
Please help me to solved this Error.
http://community.jaspersoft.com/questions/803963/outputing-txt-file
It looks like you have to set the character height and width. From the page I have linked to:
Go to Tools-->Options
Select Export Options tab --> Select Text from left pane
Set values for Character Width, Character Height, (The values I have set 7 and 13.9) Page width and Height.
Now try generating the report and it will work. Try setting different values to make it fit properly.