Velocity framework servlet - velocity

I have a module written in servlets and needs to be recently moved to velocity framework
So in the process I am rewriting the web.xml to create velocity servlet object whcih calls
our original servlet .
Now if this has to be moved to
<servlet>
<servlet-name>VeloServlet</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
</servlet>
How can we acheive this and what are all changes need to use the existing servlet as it is.
My Existing servlet looks like
<servlet-name>DataBridgeServlet</servlet-name>
<servlet-class>com.jda.pwm.databridge.framework.common.DataBridgeServlet</servlet-class>
<init-param>
<param-name>jda.databridge.config.path</param-name>
<param-value>d:/usr/databridge/conf</param-value>
</init-param>
This is loaded using the url http://localhost:8080/databridge/databridgeservlet
So in the newer case how velocity servlet calls this servlet

Have you looked at the VelocityViewServlet in the Velocity Tools project? This is a useful way of quickly getting Velocity pages on the web.
http://velocity.apache.org/tools/devel/view.servlet.html
You can subclass this for more customizability if desired. And if nothing else, you can look at the source and use this as inspiration to make your own servlet.

You should take a look at: jpublish.org (I am the maintainer, therefore biased :) and replace your Servlet with a simple Action; scripting (BSH, JS) or Java, as you feel fit. My 0.2CAD

Related

Is it necessary to migrate from ember-data/active-model-adapter to DS.JSONAPISerializer for ember 3?

Documentation for DS.ActiveModelAdapter is exists only for 1.13 (for 2 - 404:
https://api.emberjs.com/ember-data/1.13/classes/DS.ActiveModelAdapter
So, it looks like it's moved out from DS:
https://github.com/ember-data/active-model-adapter
We have ember-data 2.13.2 and it's working fine with active-model-adapter
But we got some issues with the bump to ember-data 2.14.11 with nested behavior
The big issue here is to rewrite the backend part.
We also may use RESTAdapter:
https://www.emberscreencasts.com/posts/113-restadapter-vs-jsonapiadapter-vs-activemodeladapter
but it looks like ember way is JSONAPIAdapter way:
https://api.emberjs.com/ember-data/release/classes/JSONAPIAdapter
So, generally, the question is: what way is better for ember-upgrade?
keep backend API and maintain active-model-adapter
rewrite backend API and migrate to JSONAPIAdapter (with data/relationships approach)
rewrite backend API and migrate to RESTAdapter
keep backend API and implement custom serializer to change on the fly input/output to use JSONAPIAdapter or RESTAdapter (pick best) logic on FE (maybe it's some crazy way, but it's just to ask)
Note: backend API on RubyOnRails
A rewrite of your backend is not needed. Ember Data is flexible enough to handle all REST APIs that follow some convention among their endpoints.
Let's have a look on your specific use case.
ActiveModelAdapter and ActiveModelSerializer were deprecated in Ember Data 1.13 and removed in Ember Data 2.0. But the logic itself is still available through active-model-adapter package.
All that package does is providing a customization of Ember Data's build-in RestAdapter and RestSerializer packages. If you ignore the in-source documentation it's actually not much code. You can find it in the addon/ folder of active-model-adapter package.
So even if this package would not be available you could still customize RestAdapter and RestSerializer in the same way to support your backend as is.

Is it possible to specify the client library using swagger codegen?

When generating a client based on Swagger metadata, is it possible to specify or configure things somehow that the output should use some other client library?
So if it was a C# client for example, to automatically replace the HttpClient or RestSharp client (I don't recall what it is now as I have not used it in a while) with some custom library?
Yes it is possible,
The codegen uses templates and configuation java classes to generate code in different languages. If you're willing to modify these templates and classes this would be a quite simple modification.
You can find the opensource repository here Swagger-Codegen
The template files for each language can be found here:
https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources
Java config classes:
https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages
List of template variables:
https://github.com/swagger-api/swagger-codegen/wiki/Mustache-Template-Variables
Template are written in mustache:
https://mustache.github.io/mustache.5.html
Interesting read if you want to start from scratch:
https://github.com/swagger-api/swagger-codegen/wiki/How-to-add-a-generator-for-a-new-language-or-framework

REST support within a java templating engine such as StringTemplate, FreeMarker, Velocity or Tiles?

I'd like to compare some templating engines that supports creating RESTful URLS for templating header/body/footer pages in a java application. I don't want my pages to have a jsp, .st or .ftl extension. Does anyone have links to example applications that illustrate how to set up REST with any of the popular templating engines?
Thanks.
-John
It's not a problem with any of the mentioned engines. They only provide the MVC View. The visited URL belongs to the MVC Controller (the "action"). Thus, the page URL should never contain the template file name. (In JSP Model-2 frameworks you forward the HTTP request to the view page, so in that sense the templates have an URL. But this request forwarding is entirely server side, so the template URL is still not visible on the client side.) If the MVC Controllers are JSP pages, you can still hide the .jps extension by creating a catch-all central controller servlet (or filter) that adds the .jsp extension to the URL and forwards the HTTP request internally.

How can I request pipeline processors in Apache Wicket?

Is there any way to request pipeline processors in Apache Wicket? Possibly with an open-source framework that integrates with Wicket?
I want to check requests before my web pages are rendered.
In Wicket 1.4.x, you have to extend [Web]RequestCycle, so that you an override the hook methods (onBeginRequest(), onEndRequest(), onAfterTargetsDetached(), etc.), and override Application.newRequestCycle() to return the custom class.
In Wicket 1.5.x, this mechanism has been refactored, so you can just implement the RequestCycleListener, which provides the same hooks. This new mechanism is much better, since you can compose and reuse listeners.
In Wicket 1.4.x (don't know if this has been kept in 1.5) you have RequestCycle#onBeginRequest() and RequestCycle#onEndRequest() that you can override.

HttpBrowserCapabilities Custom Browser file parsing

If I have a custom .browser file, and I want to evaluate what will happen if it is given a particular User Agent, is there any way to do that through the .NET API?
I was attempting to use HttpBrowserCapabilites, but I'm not sure how to load a custom .browser file into that class.
Normally, you should not have to explicitly load the HttpBrowserCapabilities class; ASP.NET will load it for you, as long as you have your .browser file in the right place (in App_Browsers).
However, testing it will be another problem. You can't modify the "User-Agent" HTTP Header from within either the HttpApplication (global.asax) or a custom HttpModule.
This leaves only awkward techniques, such as using Reflection to force the value, or using an external tool (such as Fiddler). Alternately, if you're good with C/C++, you could take a simple example for an ISAPI filter and modify it, then install it in IIS.
Install the User Agent Switcher Firefox extension. It will let you adjust the user agent the browser sends to the web server.
http://chrispederick.com/work/user-agent-switcher/