servlets

When does the ServletContext return a null RequestDispatcher?

眉间皱痕 提交于 2020-02-22 04:08:19
问题 The api for ServletContext#getRequestDispatcher() says: This method returns null if the ServletContext cannot return a RequestDispatcher. and Returns: a RequestDispatcher object that acts as a wrapper for the resource at the specified path, or null if the ServletContext cannot return a RequestDispatcher For what reason would the ServletContext not be able to return a RequestDispatcher? At first I figured it would be if an invalid path was passed but that doesn't return null, it results in a

Expires string in cookie header

只愿长相守 提交于 2020-02-19 09:38:38
问题 Simple question I think, but I just can't seem to find an answer. I am writing a cookie in a Java Servlet with the Cookie class which is sent to the browser in the response headers like the following: Set-Cookie: test=somevalue; Domain=.mydomain.org; Expires=Thu, 06-Jan-2011 18:45:20 GMT; Path=/ I am doing this via the Cookie class in the Servlet 2.5 API. I need to add "HTTPOnly" to the end of this String, which the Servlet 2.5 API does not support. No problem, I'll just create the String

Expires string in cookie header

倾然丶 夕夏残阳落幕 提交于 2020-02-19 09:36:27
问题 Simple question I think, but I just can't seem to find an answer. I am writing a cookie in a Java Servlet with the Cookie class which is sent to the browser in the response headers like the following: Set-Cookie: test=somevalue; Domain=.mydomain.org; Expires=Thu, 06-Jan-2011 18:45:20 GMT; Path=/ I am doing this via the Cookie class in the Servlet 2.5 API. I need to add "HTTPOnly" to the end of this String, which the Servlet 2.5 API does not support. No problem, I'll just create the String

Where to put data or config files loaded by my Java code when web app launches in a Vaadin 14 web app driven by Maven

爷,独闯天下 提交于 2020-02-15 10:07:24
问题 In a Vaadin 14 web app project created by the "Plain Java Servlet" flavor of the Vaadin Starter page, there are numerous folders automatically created by the Maven POM file process. Where is the place to put a data file or configuration file that I will load and parse when my web app launches? Under what folder do I put my files? Should I create further nested folders? And by what file path name do I find and load such a text (XML, JSON, CSV, etc.) file? 回答1: Location of file You put them in

Where to put data or config files loaded by my Java code when web app launches in a Vaadin 14 web app driven by Maven

大憨熊 提交于 2020-02-15 10:03:12
问题 In a Vaadin 14 web app project created by the "Plain Java Servlet" flavor of the Vaadin Starter page, there are numerous folders automatically created by the Maven POM file process. Where is the place to put a data file or configuration file that I will load and parse when my web app launches? Under what folder do I put my files? Should I create further nested folders? And by what file path name do I find and load such a text (XML, JSON, CSV, etc.) file? 回答1: Location of file You put them in

How to invoke a servlet without mapping in web.xml?

房东的猫 提交于 2020-02-09 11:21:28
问题 How to invoke a simple servlet using the following URL: http://localhost:8080/servlet/MyServlet I placed it in the folder: tomcat\webapps\ROOT\WEB-INF\classes I've read there is no need to mention the servlet in web.xml. I did the same. Still, I'm unable to invoke it. 回答1: I've read there is no need to mention the servlet in web.xml. You're probably confusing with the legacy Tomcat-builtin InvokerServlet which was present in older versions of Apache Tomcat (and still mentioned in poor and

Anatomy of G-WAN URI servlets

大憨熊 提交于 2020-02-07 08:26:07
问题 gwan/csp/strangesubfolder/inc.c can be visited via http://domainName.com/strangesubfolder/?inc I feel this servlet mapping strange but that suits my need. I can't find the mapping description in the gwan user's manual. Please correct me if I am wrong and confirm if it is the expected behavior. 回答1: Yes it is a standard feature. The '?' tells G-WAN that it is a servlet. If there's no '?' it will look for the file in WWW folder. Update: Now I understand your confusion. Since version release 3.3

Anatomy of G-WAN URI servlets

血红的双手。 提交于 2020-02-07 08:25:54
问题 gwan/csp/strangesubfolder/inc.c can be visited via http://domainName.com/strangesubfolder/?inc I feel this servlet mapping strange but that suits my need. I can't find the mapping description in the gwan user's manual. Please correct me if I am wrong and confirm if it is the expected behavior. 回答1: Yes it is a standard feature. The '?' tells G-WAN that it is a servlet. If there's no '?' it will look for the file in WWW folder. Update: Now I understand your confusion. Since version release 3.3

XML must be well-formed issued for web.xml file of a JSP/Servlet project

扶醉桌前 提交于 2020-02-07 03:58:46
问题 Getting the error below from Eclipse. What does it mean "must be well-formed" ? Is there a mistake in the xml? The markup in the document following the root element must be well-formed web.xml <?xml version="1.0" encoding="UTF-8"?> <display-name>...</display-name> <servlet> <servlet-name>action</servlet-name> <servlet-class>...</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> <

Wildfly: Error getting reflective information for class

杀马特。学长 韩版系。学妹 提交于 2020-02-06 07:44:34
问题 I am dealing with two Eclipse Project. The former includes some Session Beans that I manage to deploy on Wildfly Servr. The Latter includes a Servlet I need to inject and use the bean. This is the structure of the projects containing the session bean. Projects is the session bean I want to use as Session Facade to interact with the Project JPA entity. This is the servlet Injecting the Session bean. ProjectsLocal is its Local interface. @EJB private ProjectsLocal projects; /** * @see