A new bie to struts. What is the life-cycle followed and what is the relation between web.xml file and the struts-config.xml file?
Can you provide links?
http://struts.apache.org/release/1.2.x/faqs/works.html
This explains everything.....
web.xml is used for making connection between web container & web application and read by container itself when we start it.
struts-config.xml used for making connection between view & controller and initialized by using init() method.
Related
Right now I have it at the bottom of the _Layout.cshtml layout page that is used by every other page. The problem I'm having is that pages under the Identity area throw errors in the console when navigating to Identity pages:
POST https://localhost:5001/Identity/Account/_blazor/negotiate 404
and
blazor.server.js:1 Uncaught (in promise) Error: Cannot send data if the connection is not in the 'Connected' State.
These errors make me think I'm doing something wrong with how I enable Blazor Server in my RazorPages app.
So I'm wondering, should I only have the blazor.server.js scripts on pages that are actually using Blazor? Is there a way to make it available to Areas that putting it in the Layout seems to not do?
I believe this post answers my question:
How do I use blazor server-side inside a razor component library using areas?
By default, the SignalR service uses a relative path and was unable to find the _blazor/negotiate endpoint within an Area. The suggested code change in _Layout will make it use absolute paths and normalize to /_blazor/negotiate wherever you are in the page structure.
I know this is late but incase it help others.
I got this error when I was trying to add blazor to my existing app.
I added:
<base href="~/" />
at the end of the head tag of the _layout.cshtml file found in the shared folder.
enter image description here
I'm using Camel to integrate Swagger. I downloaded dist folder renamed to swagger and updated index.html but I'm not able to access ui it through my application port: http://localhost:${port}/${contextPath}/swagger/index.html
but if I type http://localhost:${port}/api-doc, I get the swagger json dump.
I can access index.html if go to the file and open it manually with browser. How do i access index.html using my application port?
http://localhost:${port}/${contextPath}/swagger/index.html
You need to expose an endpoint that would return your index.html file. Try adding the following to your RouteBuilder:
rest("/swagger")
.produces("text/html")
.get("/index.html")
.responseMessage().code(200).message("Swagger UI").endResponseMessage()
.to("direct://get/swagger/ui/path");
from("direct://get/swagger/ui/path")
.routeId("SwaggerUI")
.setBody().simple("resource:classpath:/swagger/index.html");
The first route defines a restful endpoint /swagger/index.html that accepts a GET request and returns text/html.
The second route uses Camel's Simple component to read the actual index.html into the Exchange Message Body.
So if you go to localhost:${port}/${contextPath}/swagger/index.html, it should load the index.html file correctly.
Note that inside indext.html you need to substitute the URL that would return the JSON dump of your API so that the Swagger UI can render it.
I am using Camel Jetty as the REST component. For jetty you just need add an additional ResourceHandler to handle SwaggerUI resource. Below using Spring xml language to configure REST:
<restConfiguration component="jetty" host="{{rest_hostname}}" port="{{rest_listen_port}}"
bindingMode="off" apiContextPath="api-docs" apiContextListing="true"
enableCORS="true">
<!--ResourceHandler to handle Swagger UI contents on the jetty-->
<endpointProperty key="handlers" value="swaggerUIHandler"/>
......
......
</restConfiguration>
I use swaggerUI in a jar provided by webjars. Configure handler bean:
<bean id="swaggerUIHandler" class="com.yifanwu.examples.camel.JettyResourceHandlerFactory" factory-method="buildResourceHandler">
<!--your resource path is just "swagger" assuming it is on the classpath-->
<constructor-arg name="resourcePath" value="META-INF/resources/webjars"/>
</bean>
Bean factory:
public class JettyResourceHandlerFactory {
public static ResourceHandler buildResourceHandler(String resourcePath) throws Exception {
ResourceHandler rh = new ResourceHandler();
rh.setResourceBase(JettyResourceHandlerFactory.class.getClassLoader()
.getResource(resourcePath)
.toURI().toString());
return rh;
}
}
Full example Here: github
An easier solution would be to add a web.xml file, move your resources to your /webapp directory, adding the following filter in web.xml
<filter>
<filter-name>RestSwaggerCorsFilter</filter-name>
<filter-class>org.apache.camel.swagger.servlet.RestSwaggerCorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RestSwaggerCorsFilter</filter-name>
<url-pattern>/api-docs/*</url-pattern>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
See the Camel Swagger documentation for details: http://camel.apache.org/swagger-java.html
I have built a WCF application which has Global.asax file. I have added AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)
on top of service class and added
into web.config as well.
Global.asax Application_Start event fires when debugging the application but when it deployed in the IIS7 its not firing.
Any help or idea?
Thank you.
If you make a request to your app does the "Application_Start" fire then? I don't believe it will be started until the first request is made.
Application level events only need proper naming to work. Is your codebehind class being designated in your Global.asax file?
<%# Application Inherits="YourNamespace.YourApplicationClass" Language="C#" %>
(Or)
becuase project is compiled first and then you have add or modify or changed location of global.asax.cs.
Solution :- Just remove debug folder. Clean project and then rebuild whole project.
Edit
When using the response object from an aspx page, its codebehind class or a
user control, the response object is directly available because all these
derive from the page object.
When using the response object in your own class, the object is not
available, but you can access it:
HttpContext.Current.Response. -> something
Take a look at here
Global ASAX - get the server name
I have a Phalcon Multimodule App with the following structure:
appServer
apps
api
backend
web
config
public
The backend module is my common logic module. (I think that) I need a Controller in the API to call a Controller inside backend. How can I do that? or is there a better way to access the logic within the backend module from the api module?
I have already tried adding the \AppServer\Backend\Controllers namespace to the loader inside \AppServer\Api\Module->registerAutoloaders(), but when I tried to use it inside \AppServer\Api\Controllers\IndexController->index(), it gives me an error saying it couldn't find the class.
I've read that I should get the processed module from the router, but I don't know how to do that either.
Thanks in advance for your help :)
Use this structure:
appServer
apps
api
backend
web
common
models
controllers
views
config
public
Here is an example application that uses a similar application structure: https://github.com/phalcon/album-o-rama
I am working on an app that I need to upload files using GWT in the client side, then a servlet receives the uploaded file. My problem that I need to pass the file from the servlet to the ruby on rails controller (on the same server with the servlet). Any suggestion is appreciated.
I am do not see any particular problem here. Just prepare somewhere a non GWT html page with a form, an input and submit that can send a file to your Rails server. Now everything that you need is to prepare the same form using GWT components. In a case of standart GWT components you can use FormPanel and FileUpload components. Be sure that encoding and method was correctly set (example for built-in GWT components):
FormPanel form = prepareForm();
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
// sending file
form.submit();