servlets

getString from ResultSet with spaces

喜夏-厌秋 提交于 2021-01-28 07:09:34
问题 I'm managing a JDBC database with Servlets/JSPs and one of the attributes I have in a table is a string which may or may not have spaces in between words. I have one JSP to display all the information and another one to edit it, on both I perform getString to a ResultSet and when I'm just displaying it it works fine, but on the edit JSP it only "grabs" the first word before the space and the rest of the string disappears. Here's part of the code: PerfilUsuarioConectado.jsp (the one I use to

Getting HttpServletRequest.getParts() to work with jersey

别说谁变了你拦得住时间么 提交于 2021-01-28 05:21:09
问题 I have @MultipartConfig(location="/tmp", fileSizeThreshold=1048576, maxFileSize=20848820, maxRequestSize=418018841) @Path("/helloworld") public class HelloWorld extends HttpServlet { @POST @Consumes(MediaType.MULTIPART_FORM_DATA) //@Consumes() @Produces("text/plain") public void doPost(@Context HttpServletRequest httpRequest) { System.out.println("pinged"); //... } } and I want to access the parts and get the files. But when I do httpRequest.getPart("token") I get java.lang

How to include an html fragment in a jsp that loads at run-time?

依然范特西╮ 提交于 2021-01-27 13:40:23
问题 I need to include content in a JSP without using the include directive. It is easy to do a server-side include with with <%@include file="includeMe.htm" %> but the content of includeMe.htm gets added to the JSP before the JSP is converted into a Servlet by the container. This means that if includeMe.htm gets modified, the changes are not reflected in the generated .java Servlet file. I'm tired of going into Tomcats generated files directory to manually delete the generated java and class

Servlet 3.1 - Security Constraints - Without web.xml

喜你入骨 提交于 2021-01-27 06:28:14
问题 The Java Servlet 3.0 and 3.1 specifications allow developers to perform many of the common configuration based tasks in Java code rather than via the traditional mechanism of providing a web.xml file. I have all of this working for my application, but upon looking to tackle application security, I could not find any reference to how or if it is possible to also configuration application security constraints via code. Basically, I am looking for a programmatic way to do the following:

Encrypt HTTP post parameters from JSP to servlet

橙三吉。 提交于 2021-01-19 09:12:17
问题 I have a login JSP which takes username / password from the user in text boxes and on submit it forwards the username/password parameters to Login Servlet using POST method. Now I am using Paros Proxy in between (as Man-In-The-Middle attack) to trap the parameters. The parameters received from JSP are captured in Paros as plain text. Is there any specific method provided by Java standard API which we can use to encrypt these parameters such a way that: Even if the parameters are captured by

Encrypt HTTP post parameters from JSP to servlet

风流意气都作罢 提交于 2021-01-19 09:10:25
问题 I have a login JSP which takes username / password from the user in text boxes and on submit it forwards the username/password parameters to Login Servlet using POST method. Now I am using Paros Proxy in between (as Man-In-The-Middle attack) to trap the parameters. The parameters received from JSP are captured in Paros as plain text. Is there any specific method provided by Java standard API which we can use to encrypt these parameters such a way that: Even if the parameters are captured by

An established connection was aborted by the software in your host machine tomcat jackson

自闭症网瘾萝莉.ら 提交于 2021-01-17 18:37:31
问题 Below is a stacktrace I get when my rest service tries to fetch a large data set (database and tomcat are on my local machine, so everything is local). It works on smaller ones, but in some cases user wants a lot of data. I checked similar problems posted here, but there seems to be none like mine. My questions are 1. Why does it fail to display a response? 2. Is response size limited somehow on tomcat? Maybe there is a timeout or something like that? 3. Maybe it is Jackson that fails to do

An established connection was aborted by the software in your host machine tomcat jackson

有些话、适合烂在心里 提交于 2021-01-17 18:31:55
问题 Below is a stacktrace I get when my rest service tries to fetch a large data set (database and tomcat are on my local machine, so everything is local). It works on smaller ones, but in some cases user wants a lot of data. I checked similar problems posted here, but there seems to be none like mine. My questions are 1. Why does it fail to display a response? 2. Is response size limited somehow on tomcat? Maybe there is a timeout or something like that? 3. Maybe it is Jackson that fails to do

@WebServlet fails in GlassFish 5 + JDK 13 with java.lang.RuntimeException: com.example.NewServlet.<init>(NewServlet.java:1), always at line 1

纵饮孤独 提交于 2021-01-13 09:10:16
问题 JSPs and html files are served by my Glassfish server in NetBeans, but not servlets. Latest NetBeans is configured to use JDK latest 13, and Glassfish is using Java EE 1.8 Error reported in the browser: HTTP Status 500 - Internal Server Error type Exception report message Internal Server Error description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Error instantiating servlet class com.example.NewServlet

javax servlet filter vs jersey filter [duplicate]

落花浮王杯 提交于 2021-01-05 23:51:53
问题 This question already has an answer here : What is the difference between a Servlet filter and a Jersey filter? (1 answer) Closed yesterday . I'm planning on writing a servlet application (meant for deployment with OSGI) and use some filters for HTTP header pre-processing. While originally settled on the javax.servlet filter implementation, it occured to me that I actually don't know why/when one would choose to use that vs the Jersey ContainerRequestFilter. Granted the latter comes with some