Dean O'olish

Greenhorn
+ Follow
since Mar 03, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dean O'olish

Rob Prime wrote:It might help if you told us exactly what methods / classes are deprecated. If you use -Xlint:deprecation to the compiler flags the compiler will tell you.



The three methods are setStatus, encodeRedirectUrl and ecnocdeUrl, however I am NOT using them. I am only implementing the HttpServletResponseWrapper interface, which I am guessing has a concrete class that does. I just need to figure out how to stop these from showing up on the build file. My manager keeps thinking they're errors when they're not.

I've done some research and found out that these are the result of a bug which has since been fixed in the latest release, however we are using 1.5 and the fix is not in place yet. Do you know how to suppress these warnings?
11 years ago
I have a class that extends HttpServletResponseWrapper and I am getting compile time warnings about some of the classes methods being deprecated. How do I get rid of these?

I've tired @SuppressWarnings("all") at the beginning of the class, however this does not work... any thoughts?
11 years ago
I am obtaining a string of HTML and I need to parse this HTML and turn it into a text file. I have everything else working except a way to parse the HTML string. There are a handful of tags that I need to do some formatting on; for example a table row (<tr> or <tr class=""..) needs to be replaced with a "\r".

I am having a hard time finding a regular expression that can accomplish this.

Below is exactly what I am trying to do



should be parsed to



Can anyone help me out with this?

Thanks!!!
11 years ago
I finally figured out how to get the content of the JSP from my servlet code. I used a ResponseWrapper object. I am running into an issue now though when I try and change the responses content type to "text/plain". The JSP still renders as HTML and not as plain text.

Below is the pseudo code as the real code is at work and I dont have access to it:



The following does not work as the content type is ultimately now changed. The only thing I can think of is that there are other filters (which there are) that are setting the content type. I thought this wouldnt be an issue since I placed my filter at the end of the filter section within the web.xml file. Since the web.xml file calls the filters in the order in which they are placed, I figured my filter would be called last and the response would be able to set the content type.

Does anyone have any ideas on how I might fix this?


- D
11 years ago
Last night I was able to find the following code online which works great in JBoss and Tomcat (same containers I believe), however it will not work with WebLogic. This code wraps the response and buffers it so the calling Servlet can then view the rendered content of the JSP.

The one thing I do notice is that the ByteArrayOutputSteam is not explicity written to... is this handled by JBoss' container implicitly? (I made note of it in the code below lines 52 - 58) If anyone has any ideas, can you let me know...

Thanks

11 years ago
ya, I enjoy scrolling down to the bottom of a long thread just to read a one line comment... It's a lot easier ontop Bear

Bear Bibeault wrote:

Dean O'olish wrote:Easier to read


For who? Certainly not the typical reader of these forums.

11 years ago

Eric Pascarello wrote:Offtopic..Can I ask why you type your response before the quoted text. It is rather backward convention.

Eric



Easier to read
11 years ago
Eric,

As I've stated I'm not doing that anymore and trying to get the information from the request

Eric Pascarello wrote:If you are going to request the file via Ajax it is not going to be a textfile in the responseText.

Eric

11 years ago
Our client wants to view the jsp as a text file (I dont know why, but I have to build it) with the HTML stripped.

How do you propose that I call the JSP and get a hold of the rendered content?


Eric Pascarello wrote:Why are you converting it to a textfile?

I would request the page that you are grabbing the contents for and output back the response to the client. No need to store it in a txt file unless you play on using that at some later time and do not want to fetch it again.

Eric

11 years ago
I have, I know Ajax/JS very well... using mootools, prototype, jquery as well as my own libraries. I've decided not to go with the idea of screen scraping and am trying to figure out how I can get the HTML content as a String through my Struts Action class. I've seen some posts where others have either suggested or tried creating a HttpResponseWrapper class, but I have not been able to make it work for me as of yet...

My work does not want to use a filter nor custom tags, which leaves me with wrapping the Response.

I think I may have to brush up on my OutputStream class. What I am trying to accomplish is:

1. view the HTML from the request in a readable form to make sure all the content is there.
2. take that readable content and put it through a proprietary library that turns a String of HTML into a text file
3. display that text file to the user


any suggestions would be greatly appreciated

Thanks




Eric Pascarello wrote:"content was too big" What is too big?

Have you gone through basic Ajax tutorials on how to send post data to the server and dispay a result on the page? If you have not, it might be a good time to try it and not jump right into a big task.

Eric

11 years ago
I am trying to get the HTML, parse it into plain text, however I am having a hard time figuring out a way to get that HTML content from either the front end or the back end. I tried capturing its dynamic (depends on request and session information) information at the servlet, then parse it... but I can not figure that out.


I next thought I would try and screen scrape and pass the string html content to the server through a post, but the content was too big, and Ajax is just annoying with something like this.


Any suggestions on how to get the rendered content of a JSP into my servlet action (using struts)?

Thanks



Paul Clapham wrote:First step would be to determine the requirements.

It doesn't make sense to say you want to "get the HTML into text", because HTML is already text. And there's this "hidden markup"... what is that?

And when your client is viewing a web page, what are they using to do that? A browser connected to the web page? A text editor looking at the source code... the HTML?

And are these web pages just anything they can get to on the web, or just the web pages served by your site?

11 years ago
I have been tasked by my management to allow a user to click on a "Text File" icon and allow the user to view the current jsp as a text file (Needs both Session and Request Object information so URL Object is out since it can not pass these two things). Sounds pretty easy right... well I am running into a lot of problems. I've asked about using filters and custom tags and both are out of the question since filters are handled on EVERY request/response and custom tags would take to long time to implement on EVERY jsp (over 1000 jsp's).

This only leaves me with being able to capture the content through a dispatch Object. I've tried creating a HttpServletWrapper Object that extends the HttpServlet Object, however it kept coming back without the content.

Does anyone have any suggestions or maybe you've done this and can shed some light onto this mystery.

I've searched on this forum thoroughly and posted a couple questions to certain individuals who have over come this, but have not pasted their solution... hopefully you might be able to help me out.


Thank you for any help,


Dean O
11 years ago
I am not and nor would I want to... I am just explaining what I have tried or was thinking...

Bear Bibeault wrote:

Dean Oo wrote:but am having a hard time passing the information via AJAX since a web page is pretty large and the querystring can only have so much information.


Then don't pass it in the query string.

11 years ago
Java Ranch will not allow "O" to be the last name and my last name begins with 'O'... so instead now I made it 'Oo'...




Bear Bibeault wrote:"Dean Ooooh", firstly, please check your private messages for an important administrative matter.

Secondly, please read this for information on replying to older posts. This post is almost three years old.

11 years ago
JSP
Can you post your code? I am having the same problem but am having a hard time figuring out how to fix it


Thanks,

- D



Harathi Rao wrote:Thanks to Ben and Lynette for the help I have resolved it. What I needed was a class which implemented HttpServletResponseWrapper.

11 years ago
JSP