I've never come across this extension before. It's being used for a front-end interface to a j2ee backend.
It's probably just a URL pattern for firing a Struts action. Most people stick with the .do convention, but you can make the actions fire on just about anything you want.
See Section 5.4.2 on this site for more info
This is servlet mapping in j2ee application where you can define the url pattern for a particular servlet and you can name it as you want in this one it name like .action you can give like .yourname or anything.
This mapping you can give in your web.xml using servlet-mapping tag and url-patten tag in it.
Thanks
Related
I'm trying to use Spring Web on Tomcat to build an API server. This is just a request-response API, not a full web app - it won't have any web pages or static assets like images. As such, I think SpringWebMVC is the wrong technology since I don't actually want the MVC part of it, so I'm just just trying to use plain old SpringWeb.
Unfortunately, practically every tutorial I've found online uses the org.springframework.web.servlet.DispatcherServlet which is from the MVC package, not from the base package. In the base package, the only viable HttpServlet implementation I found was org.springframework.web.context.support.HttpRequestHandlerServlet. However, this servlet doesn't seem to honor #RequestMapping or #RequestBody or #ResponseBody annotations in the handler.
I thought perhaps I'd just create multiple handler servlets and just use the url-pattern on each of them in the web.xml to route them correctly, but it turns out url-pattern doesn't support path variables either (at least as far as I can tell).
So is there a way to properly set up this servlet to be able to handle request mappings with path variables like so?:
GET /foo/{fooId}
POST /foo/{fooId}/fooOperation
POST /bar/{barId}/barOperationA
POST /bar/{barId}/barOperationB
POST /bar/{barId}/barOperationC
I have a page in which I have deployed a portlet, in my portlet I access some params using the url in the browser like:
localhost.com:8080/mypage?text=helloworld
with using
PortalUtil.getOriginalServletRequest(request).getParameter("text")
and it is working fine.
The issue comes when there is some latency in view.jsp rendering (like putting some debugger in Java code) and in the meanwhile the render portlet view.jsp is called again but this time I cannot read the "text" param from request
From client side the url being called is as follows:
> http://localhost:8080/c/portal/render_portlet?p_l_id=92438&p_p_id=editor_WAR_heliumportlet&p_p_lifecycle=0&p_t_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=0&p_p_col_count=2&p_p_isolated=1¤tURL=
> ...
This url doesn't contain my param, I can't find a clue from where this url is triggered. Any help would be greatly appreciated.
Liferay can push portlets to be rendered asynchronously if they take too long to load (e.g. when attached to a debugger). This is due to the default values for render-weight and ajaxable, which allow this. Change them in liferay-portlet.xml.
Also note that fetching generic HTTP parameters that are not namespaced is not part of the spec, that's why Liferay doesn't care to forward the non-namespaced-parameter from the original URL to your portlet when it rendered it via AJAX. In other words: By using this technique you're probably preparing yourself for quite some more trouble in future.
As far as portlets can share the same page with other portlets, portlets use to have a prefix or a namespace.
This namespace can be always the same for a given portlet if this portlet is not instanceable. Or this namespace ca be variable with the purpose of being unique for each instance of the portlet.
So, the parameters for a portlet must be prefixed with the namespace.
Then, it will be easy to access this param using util tools like..
ParamUtil.get(renderRequest, "paramName", "defValue");
Here the java doc
https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portal/kernel/util/ParamUtil.html
Regards
I have a SPRING application running (using spring boot) either directly on Java or on a Tomcat 7 server. I need to create absolute URL's for a couple of pages (mappings) so that these links can be sent via e-mail.
I thought this would be simple, but now it seems hard. I would prefer a solution that is 100% written in Thymeleaf, but if that is not possible, I can certainly provide Thymeleaf with some variables from my Java code.
Anyone solved this before in Thymeleaf?
In my opinion, you should provide a server URL in a property file and than access it in Thymeleaf. You can do it by accessing Spring Bean in a view:
<div th:text="${#urlService.getApplicationUrl()}">...</div>
In the above example, the urlService is a Spring Bean.
Please see this answer: https://stackoverflow.com/a/675903/718515
You may be also interested in #ctx variable that gives you access to servletContext. See Thymeleaf docuementation: http://www.thymeleaf.org/doc/html/Using-Thymeleaf.html#base-objects
I hope it helps!
I just did something similar where I was using Thymeleaf to generate an HTML email (and so of course links had to be made absolute). I used Thymeleaf's built-in #{} link syntax to create the appropriate URL relative to the server (since it calls the HttpServletResponse.encodeURL() which I needed to do as I had a custom implementation to do some additional URL munging), and then uses Spring's ServletUriComponentsBuilder to make the URL absolute using the HttpServletRequest server information.
<p th:with="
relativeCustomerInfoPath=#{|/my/path/${customer.code}/info/|},
customerInfoPath=${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder).fromContextPath(#httpServletRequest).replacePath(relativeCouponPath).toUriString()}">
Go see your info at
<<a th:href="${customerInfoPath}" th:text="${customerInfoPath}">Link</a>>.
</p>
There may be a better way, but this worked well for me and does the making of the URL absolute entirely within Thymeleaf (though using Spring's library).
Today I made an integration that suggested using the full Url for compatibility.
The base should change according to enviroment (I just send it as attribute).
The last #{/js/i/dyn} is to get the contextPath.
<script th:src="${'https://' + base} + #{/js/i/dyn}"></script>
ref: http://www.thymeleaf.org/doc/articles/standardurlsyntax.html
I have a project that I can see the JSP's... However Jboss shows me the servlets so in the address bar all i can see is:
"appservleer?=AppDev"
This is an example not the actual address...but with that info only how can I know which JSP is being displayed at that moment by JBoss.
or am I understanding this Jboss, servlet, JSP incorrectly?
Some guidance would be appreciated.
Thanks.
You cannot know which jsp is being displayed unless the developer decided to give hints about it.
A jsp is just a view technology that the servlet uses to render a response. That is, typically, the jsp will be parsed and html will be generated. However, the developer of the servlet may decide to write to the response himself. So nothing can really tell you if what you got came from a jsp or from another source, even if you had a url like www.mydomain.com/page.jsp. Nothing guarantees the response you are seeing in your browser was generated from a jsp.
The only way to know for sure which JSP is used for rendering is to look at the source code of the servlet that is mapped under (in your example) "appservleer".
Look in web.xml which servlet is mapped with this path, and open the source code of this servlet. Then figure out the execution path, starting with the doGet(...) or the doPost(...) method, and see to which JSP it is forwarded in the end...
Good luck.
You should always start with the web.xml file which will eventually lead you to the actual jsp file that is displayed. Start with the servlet mapping and check which servlet is invoked for the url. Then dig into the servlet to find out which jsp it is redirected to. If you are using any application framework then look for the implementation to findout the mapping. For e.g. in spring the spring configuration files or the controller classes tells you where the calls are redirected to.
I am new to J2EE and related stuff in general. I am trying to move a particular web application from a Sun One server deployment on to JBoss. The application is filled with a lot of servlets where each one re-directs to another.
There are way too many servlets for me to enter a mapping between each of these servlet class to a URL-mapping individually in web.xml. The application code has many redirects where they name the servlet class names itself in the redirect-URL. As of now when I run it on JBoss the redirections to URL with servlet classnames in URL don't seem to work on JBoss (it gives a 404: Not Found, probably since there is no mapping in the web.xml). So is there any config setting that I can set to allow this to happen or should manually enter each and every URLpattern-to-Servlet mapping in the web.xml?
Thank you.
There are two solutions.
As we know JBoss uses Tomcat under the hood as a servlet container. You can enable invoker servlet, that would save you from mapping the whole lot in web.xml. But beware, it will be naive to do that, and not at all encouraged.
Secondly, you can write another servlet/filter and map just that in your web.xml for every url pattern, may be. Then that new servlet of your can forward the requests to whatever servlet it should.
I hope you get my point.
Not sure what you mean by this
the application code has many redirects where they name the servlet class names itself in the redirect-URL
Do you have hardcoded urls in the servlet classes? How many servlets? If you have hardcoded urls they may all have broken because the context is slightly different, or the appname, etc.etc. Can you post an example?
Well, there are some hard-coded URLs in the code, but even if i typed in the right URLs in browser directly I still get a 404. There are about 30 servlets (a conservative approximation). Ex: http://FQDN_SERVER.com/?arg1=ABCD&arg2=XYZ
Here the servlet-classname is literally the classname of the servlet without ".class" extension, which may not be a good practice. But the code is full of such redirections and if I have to change this then I have to add a new url-pattern to each of these servlets in the web.xml and construct a new red-rect URL for each of these servlets. So is there anyway I can avoid this or will I have to go through the pain of doing the above mentioned?
Thanks,
Manoj
Sorry the URL-pattern looks this http://FQDN_SERVER.com/servlet-classname?arg1=ABCD&arg2=XYZ