Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!

Mateus Lucio

Ranch Hand
+ Follow
since Jul 27, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mateus Lucio

It does work for me
I rushed myself and did not pay attention to the protocol-less uri recommendation.

This approach works perfectly!

Thank you Bear and Ron for your replies!
5 years ago
Hi there!
Hm, well, I think I need to give a little more detail...

My API returns something like this:

So, the first problem is, I'm serving files.
Second, they're under a static domain which is not the same as my app. The app is running under for example.
So this is not valid:

I have client apps running under http and https but right now if and https app uses my service it can't just render "" on a webpage because the browser will block the file, considering it an unsafe content.
5 years ago
Hello everyone!

I was reading some online posts and articles related to links (href) in a json/xml response.
When I looked up "hypermedia" I found some examples like this:

This would work just fine except for one detail. The protocol (http). What if my application is responsible for returning this link without knowing if the client uses http or https?
This way the client has to figure out what's the correct protocol and I'd like to avoid that but would this be acceptable?

Or this would be better?

Thanks in advance!
5 years ago
Hi Rachna

${a.b} - this will return the b object

if ${a.b} is being printed then
if b is a primitive or a string then you get it's value otherwise you will get it's string representation, which is equivalent to b.toString()

samething with cookie.JSESSIONID or any other cookie

cookie implicit object is a map which means that cookie.JSESSIONID return a cookie object, if you want its value then use cookie.JSESSIONID.value
Based on the javabean convention the property name is based on the name of the getter and setter method.

So if you have a setWeight and setName then you have two writable properties, weight and name.
The name of the variable that holds the value doesn't matter

take a look at this example:

Imaginary declares 2 properties but doesn't implement any.
Yes, it is possible to get a SimpleTag Parent calling getParent() method in a ClassicTag, since SimpleTags have another class hierarchy you cannot directly cast you SimpleTag parent reference, for that a TagAdapter is supplied, take a look at javax.servlet.jsp.tagext.TagAdapter, it's mainly purpose is to wrap a SimpleTag and exposes it as a Tag reference.
Yes, assuming that you have 10 diferent servlets in your webapp then the container will create/allocate 1 thread per request, independently of what servlet will serve that request.
Hi there Pratik!

First of all, Congratulations for your achievement !!!

Would you mind to post your impression about SCBCD exam?

Thank you and once again congratulations!!
Hi Harshana, here my understanding:

When you return SKIP_BODY you're saying that the tag doesn't have a body, so there's no point in running doAfterBody() method, when you return EVAL_BODY_INCLUDE you are saying to your tag process the body (and implicity saying that you tag has a body, it may be empty but it's still a body) so it makes sense to call doAfterBody() method.

About the statement
"it directs the body of the tag to a buffer which this tag does not process" I believe the book means the example tag doesn't process the body you could write one that does.
Yes, an EL Exception will be thrown!

Since it's a bean object ${customer.age} it's like customer.getAge() but that method does not exists.
HttpSessionActivationListener and HttpSessionBindingListener doesn't need to be placed in web.xml because these listener notify the objects that are bound to a session and not the session itself.
For me only reading doesn't work, I need to write some code and think a little about a situation to use some resources, I usually build sample applications to test things like listener, jstl, custom tags and so on ... if I don't have a good scenario I do the simplest (and usually useless) thing the comes to mind like listener that only prints things to console or create tags that already exists.
IllegalArgumentException makes sense for me ... you see, getRequestDispatcher method takes a String argument that must start with a slash "/", so any String that doesn't start with a slash is an illegal argument.

Remember that this rule only applies when you get the RequestDispatcher from the ServletContext, in your example you got it from the HttpServletRequest so a String that doesn't start with a slash is a perfectly valid argument.

It's vendor specific, in tomcat the default is 30 min and you can configure it in tomcat_home/conf/web.xml

this configuration applies to all web apps deployed
only one <auth-contraint> with 0 to many <role-name> tags inside