Search Results

Search found 696 results on 28 pages for 'servlets'.

Page 10/28 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Dispatch request to an Async Servlet from managed bean generate exception

    - by Thang Pham
    when a button click, I need to have stuff running in my background, so I have a async Servlet. From my managed bean, if I do redirect, it works great (meaning that it execute my run() method inside my class that extends Runnable correctly). Like this String url = externalContext.getRequestContextPath() + "/ReportExecutionServlet"; externalContext.redirect(url); But if I switch to dispatch, like this externalContext.redirect("/ReportExecutionServlet"); it fail when I try to obtain the AsyncContext AsyncContext aCtx = request.startAsync(request, response); The error is below Caused By: java.lang.IllegalStateException: The async-support is disabled on this request: weblogic.servlet.internal.ServletRequestImpl Any idea how to fix this please? NOTE: This is how to execute my async servlet, just in case: AsyncContext aCtx = request.startAsync(request, response); //delegate long running process to an "async" thread aCtx.addListener(new AsyncListener() { @Override public void onComplete(AsyncEvent event) throws IOException { logger.log(Level.INFO, "ReportExecutionServlet handle async request - onComplete"); } @Override public void onTimeout(AsyncEvent event) throws IOException { logger.log(Level.WARNING, "ReportExecutionServlet handle async request - onTimeout"); } @Override public void onError(AsyncEvent event) throws IOException { logger.log(Level.SEVERE, "ReportExecutionServlet handle async request - onError"); } @Override public void onStartAsync(AsyncEvent event) throws IOException { logger.log(Level.INFO, "ReportExecutionServlet handle async request - onStartAsync"); } }); // Start another service ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10); executor.execute(new AsyncRequestReportProcessor(aCtx));

    Read the article

  • UnsupportedEncodingException thrown when using Resin and Grails

    - by knorv
    I've encountered a strange problem in a Grails webapp running under Grails: java.io.UnsupportedEncodingException is thrown quite frequently due to various unknown encoding strings (such as "ISO8859_10", "ISO-8859-10"), and the strange thing is that this is done entirely within the Resin and Grails code. That is - no custom code is involved when the exception is thrown. I'm not sure if it is Grails or the servlet container's code that should handle the exception. But I'd assume that the exception should be handled somewhere and not bubble up all the way to stderr. This is the exception in full: java.io.UnsupportedEncodingException: ISO-8859-10 at com.caucho.vfs.i18n.JDKWriter$OutputStreamEncodingWriter.<init>(JDKWriter.java:112) at com.caucho.vfs.i18n.JDKWriter.create(JDKWriter.java:79) at com.caucho.vfs.Encoding.getWriteEncoding(Encoding.java:231) at com.caucho.server.connection.ToByteResponseStream.setEncoding(ToByteResponseStream.java:137) at com.caucho.server.connection.AbstractHttpResponse.setLocale(AbstractHttpResponse.java:1683) at com.caucho.server.connection.HttpServletResponseImpl.setLocale(HttpServletResponseImpl.java: 115) at javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:139) at javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:139) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1035) at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:290) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:114) My questions: Should the exception be handled? If so, is it the responsibility of the servlet container (Resin) or the web framework (Grails)? How would you go about solving this? (I'd rather not having the exception log cluttered with exceptions that I can do nothing about.)

    Read the article

  • Asynchronous Processing in JBoss 6 ("Comet")

    - by chris_l
    edit: Retagged as tomcat, since this is really a question about the Tomcat embedded inside JBoss 6, rather than JBoss itself I have an extremely simple servlet, which works on Glassfish v3. It uses Servlet 3.0 Asynchronous Processing. Here's a simplified version (which doesn't do much): @WebServlet(asyncSupported=true) public class SimpleServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final AsyncContext ac = request.startAsync(); ac.setTimeout(3000); } } On JBoss 6.0.0 (Milestone 2), I get the following Exception: java.lang.IllegalStateException: The servlet or filters that are being used by this request do not support async operation at org.apache.catalina.connector.Request.startAsync(Request.java:3096) at org.apache.catalina.connector.Request.startAsync(Request.java:3090) at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:990) at playcomet.SimpleServlet.doGet(SimpleServlet.java:18) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) ... Do I have to do anything special to enable Asynchronous Processing in JBoss 6? Or do I need an additional deployment descriptor? ...

    Read the article

  • Handling Character Encoding in URI on Tomcat

    - by ZZ Coder
    On the web site I am trying to help with, user can type in an URL in the browser, like following Chinese characters, http://localhost:8080?a=?? On server, we get GET /a=%E6%B5%8B%E8%AF%95 HTTP/1.1 As you can see, it's UTF-8 encoded, then URL encoded. We can handle this correctly by setting encoding to UTF-8 in Tomcat. However, sometimes we get Latin1 encoding on certain browsers, http://localhost:8080?a=ß turns into GET /a=%DF HTTP/1.1 Is there anyway to handle this correctly in Tomcat? Looks like the server has to do some intelligent guessing. We don't expect to handle the Latin1 correctly 100% but anything is better than what we are doing now by assuming everything is UTF-8. The server is Tomcat 5.5. The supported browsers are IE 6+, Firefox 2+ and Safari on iPhone.

    Read the article

  • Where to store a DataSource resource in a Java web app?

    - by Slavko
    This is a rookie question. What's the best place to put @Resource private DataSource ds; in a web application? Do I put it in a servlet, context listener or maybe there's a better place for it? Also, do I create a new Connection object in my doGet()/doPost() or should I do it somewhere else? What's the best practice for stuff like this? Thank you!

    Read the article

  • How to get the file name for <input type="file" in jsp

    - by deepthinker121
    I want to read the file path from html input type="file" (the entry selected in the file dialog by the user) <script> function OpenFileDialog(form) { var a = document.getElementById("inputfile").click(); SampleForm.filePath.value = //set the path here document.SampleForm.submit(); } </script> <form name="SampleForm" action="TestServlet" method="get"> <input type="file" style="display:none;" id="inputfile"/> <a href="javascript:OpenFileDialog(this.form);">Open here</a> <input type="hidden" name="filePath" value=""/> </form> I want the path of the selected file to be read in my Servlet class How do I get the file path? Can I read it from var a? Or is there any way to directly access the file path from the input type="file" from my servlet?

    Read the article

  • Why servlet halt a moment in concurrent request.

    - by Hlex
    I use Axis for webservice service. when more than 8 concurrent , there are some request halt randomly for about 30 seconds. I debug by log in every line and found from my code: public class foo{ void bar(){ a(); log.debug('exit from a'); } void a(){ log.debug('exit a'); } the time between "exit a" and "exit from a" are delay about 30 second. This is no reason. I try to increase web container thread pool , heap but didn't help ============== Enviroment websphere 6.1 Spring 2.5 , Hibernate 3 ,Axis 1.6.5 Min heap to 768 Max heap to 1024 Thread pool defult max to 300 Thread pool web container max to 500 ===============

    Read the article

  • servlet does not envoke when I call a from method.

    - by saloni
    My web.xml is like <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>sample</display-name> <servlet> <servlet-name>Sampleclass</servlet-name> <servlet-class>sample.SampleClass</servlet-class> </servlet> <servlet-mapping> <servlet-name>Sampleclass</servlet-name> <url-pattern>/SampleClass</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/page/form.jsp</welcome-file> </welcome-file-list> </web-app> and form.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <h1>A simple web application</h1> <form method="POST" name="Sampleclass" action="SampleClass"> <label for="name">Enter your name </label> <input type="text" id="name" name="name"/><br><br> <input type="submit" value="Submit Form"/> <input type="reset" value="Reset Form"/> </form> </body> </html> and SampleClass.java is public class SampleClass extends HttpServlet { public void init(ServletConfig config) throws ServletException { super.init(config); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String age = request.getParameter("age"); PrintWriter out = response.getWriter(); out.write("<html>Hello Your name is "+name +", and your age is "+age+"</html>"); } public void destroy() { } } but I am getting error when I entered to submit button of form.jsp and error is type Status report message HTTP method POST is not supported by this URL description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL). I am not understanding that what is the problem exactly ? Please help..

    Read the article

  • Uploadify uploadSettings with scripData does not work

    - by kubilayeksioglu
    Hi everyone, I am sending a file to my Java Servlet via jQuery Uploadify, there are no problems while sending the actual file. But when I try to send some scriptData with file along, to process on Servlet it just does not send anything. Here is the JS code: $("button").click(function(){ $("#uploadify").uploadifySettings('scriptData', {'length':'0.2'}); $('#uploadify').uploadifyUpload(); }); $('#uploadify').uploadify({ 'uploader': 'assets/uploadify/uploadify.swf', 'script': 'upload', 'folder': '/uploads' }); And here is the Servlet code on the server side: out.println(res.getParameter("length")); Only output I get is null, while expecting "0.2". I just cannot get what's wrong and any kind of help will be appreciated. Thanks in advance.

    Read the article

  • cookie name is truncated in Servlet 3.0 HttpServletRequest (Glassfish V3)

    - by idplmal
    I'm porting our Web authentication/authorization middleware for use in containers implementing the new servlet 3.0 API (Glassfish V3 in this case). The middleware pulls cookies from the HttpServletRequest filtering on cookies with names of the form "DACS:FEDERATION::JURISDICTION:username". This works fine in the version 2.5 servlet API but is broken in 3.0. The cookie names in 3.0 are being truncated at the first ":" in the name. I understand that the servlet 3.0 implementation defaults to RFC 2109 cookies which are more restrictive about cookie names than the old Netscape spec (":" is among the characters not allowed in RFC 2109 cookie names). Digging into the servlet 3.0 source code, it appears that the use of RFC2109 names can be disabled by setting a System property "org.glassfish.web.rfc2109.cookie_names_enforced" to false. I've tried this to no avail. But besides that, the code that uses checks cookie names is in the constructor for Cookie, and it would appear that the truncation is occurring elsewhere. So - finally - the question. Have others bumped into such issues in the servlet 3.0 API and have you found a work around?

    Read the article

  • Servlet Session - switch from URL Rewriting to Cookie

    - by lajuette
    Situation: I have a "dumb" Javascript frontend that can contact some kind of SSO middleware (MW). The MW can obtain sessions by issuing requests that contain authentication credentials (username, password). I.e. the session will be created for a certain user. My frontend needs to "restart" the session to gain the user's permissions to the target system. For that i need a valid session cookie. The target system is not under my control (could be a more or less public WFS, WMS, etc.), so i cannot add any SSO mechanism to it. Question: Is it possible to "steal" a Session forging a request which URL contains a valid session ID in the jsessionid parameter? Goal : Issue such a request to a Servlet and make it respond with a Set-Cookie header that contains the same id. That way the frontend joins the session and may do whatever the user, which was used to create the session, is able to do.

    Read the article

  • How to set the path to "context path" for uploaded files using Apache Common fileupload?

    - by BugKiller
    Hi, I'm using Apache common fileupload library with Netbeans 6.8 + Glassfish.I'm trying to change the current upload path to be in the current context path of the servlet , something like this: WEB-INF/upload so I wrote : File uploadedFile = new File("WEB-INF/upload/"+fileName); session.setAttribute("path",uploadedFile.getAbsolutePath()); item.write(uploadedFile); but I notice that the library save the uploaded files into glassfish folder , here what I get when I print the absolute path of the uploaded file : C:\Program Files\sges-v3\glassfish\domains\domain1\WEB-INF\upload\xx.rar My Question : How can I force the common fileupload to save the uploaded file in a path relative to the current servlet path , so I don't need to specify the whole path ? is this possible ?

    Read the article

  • get string from outside run programm

    - by Alex Berd
    Hello I have jsp page with text field and button. Also i have jar of another project. When i click on the button the MAIN.class of the jar is called and program is running in independent window(JFrame). After user is finished with the program and exits, I need to get the String of program that is generated on exit and paste it into the textbox (The String is HTML code) Is anyone else having this problem and has a solution? Thanks Alex

    Read the article

  • Get status of servlet request before the response is returned

    - by Alex
    Good evening, I am in the process of writing a Java Servlet (Struts 2, Tomcat, JSP etc) which is capable of doing some fairly complex simulations. These can take up to 2 minutes to complete on the and will return a graph of the results. It is trivial to calculate the percentage of the simulation completed because the process works by repeating the same calculations 1000s of times. I would be interested to know if anyone has ever tried to use client side technology to provide any estimate of the percentage complete. I.e query the servlet processing to get the number of cycles completed at various point throughout the simulation. This could then be displayed as a bar in the client browser. Any thoughts, advice, resources would be much appreciated. Thanks, Alex

    Read the article

  • Hidden features of JSP/Servlet

    - by mkoryak
    I am interested in your tricks etc used when writing JSP/Servlet. I will start: I somewhat recently found out how you can include the output of one JSP tag in an attribute of another tag: <c:forEach items="${items}"> <jsp:attribute name="var"> <mytag:doesSomething/> </jsp:attribute> <jsp:body> <%-- when using jsp:attribute the body must be in this tag --%> </jsp:body> </c:forEach>

    Read the article

  • How to implement custom JSF component for drawing chart?

    - by Roman
    I want to create a component which can be used like: <mc:chart data="#{bean.data}" width="200" height="300" /> where #{bean.data} returns a collection of some objects or chart model object or something else what can be represented as a chart (to put it simple, let's assume it returns a collection of integers). I want this component to generate html like this: <img src="someimg123.png" width="200" height="300"/> The problem is that I have some method which can receive data and return image, like: public RenderedImage getChartImage (Collection<Integer> data) { ... } and I also have a component for drawing dynamic image: <o:dynamicImage width="200" height="300" data="#{bean.readyChartImage}/> This component generates html just as I need but it's parameter is array of bytes or RenderedImage i.e. it needs method in bean like this: public RenderedImage getReadyChartImage () { ... } So, one approach is to use propertyChangedListener on submit to set data (Collection<Integer>) for drawing chart and then use <o:dynamicImage /> component. But I'd like to create my own component which receives data and draws chart. I'm using facelets but it's not so important indeed. Any ideas how to create the desired component? P.S. One solution I was thinking about is not to use <o:dynamicImage/> and use some servlet to stream image. But I don't know how to implement that correctly and how to tie jsf component with servlet and how to save already built chart images (generating new same image for each request can cause performance problems imho) and so on..

    Read the article

  • How to add resource files during build on J2ee (eclipse + jboss)

    - by legendlink
    hi, i'm trying to run a web servlet project in eclipse 3.4 using jboss 4.2.2 as my web server. im using the wtp plugin and everything looks good (can run and debug). but some of the files/resources are not included on the war file. in my "WebContent/WEB-INF" folder, i have "properries", "config", and "lib" folders. but it seems like when i build and publish the project, only "config" and "lib" folders are included. how can i include the "properties" file during build?

    Read the article

  • Servlet unit test

    - by Thomman
    Currently I'm using TestNG framework for testing application business logic, i added some Servlet classes recently. How do I unit test these Servlet classes in TestNg framework?

    Read the article

  • Anyone up to creating a tomcat based alternative for GAE?

    - by bach
    Hi, If we had the possibility to run GAE app without any code change on our servlet engine that would be great because: in case that google changes their billing policy we can just jump to our own server or in case their current policy doesn't fit our app needs we can do stuff which is not allowed in the GAE, compromising a 1 JVM, 1 DB We don't actually need a distributed system but more of a realtime system with synchronize, true locking mechanisms, other servers/software installed on the server machine, socket interface etc... Such a package should include at least: TomCat (or equivalent) DataNucleus Access Platform (Task Queue service) Any idea if it's easy to get such a thing or if it's already exist somewhere? Thanks

    Read the article

  • How to save, retrieve and draw an image in webapplication using Java and PostgreSQL?

    - by spderosso
    Given an object X; I want this object to have an image. The image must be stored in the database. I can't store the path, the actual image must be in the database. My question can be answered by answering the following subquestions: a). What type of field should I put in the database? (e.g VARCHAR) b) What type of object should I use for storing and manipulating the image (at an object layer)? (e.g java.awt.Image) c) How do I create an object of the type selected (answer of question b) from the data obtained from the database? d) How do I save an object of the type selected (answer of question b) to the database? e) How do I draw the image on a web page? I am using PostgreSQL, Java and it is a web application. Thanks!

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >