Need a help about init action in HttpServlet

I provided a new class MServlet which extends HttpServlet.
I want to use the Mservlet class for my all servlets. My Mservlet must do some thiggs.
For example i have a class:
public class ListNews extends MServlet
So now i need some things would be done automaticaly. For example
response.setContentType("text/html;charset=windows-1257"); must be setted
that i do nor need to write this line in all servlets?
How i can do it?
If i am using public void init method in servlet and put there the string
response.setContentType("text/html;charset=windows-1257");
This does not work
Thanks

Just a minor switch with the previous post...
Use the MServlet to implement the doGet and doPost methods, make them final so that the subclasses can override them.
Provide a 'responseSetup' method that sets things that you want.
Provide your own 'doGetWork and doPostWork methods that the subclass overrides with its own stuff:
public MServlet extends HttpServlet {
  public final void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
      responseSetup(response);
      doGetWork(request, response);
  public final void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
      responseSetup(response);
      doPostWork(request, response);
  //Default implementation does the same as HttpServlet.doGet()
  public void doGetWork(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
      super.doGet(request,response);
  //Default implementation does the same as HttpServlet.doPost()
  public void doPostWork(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
      super.doPost(request,response);
  //Do your init stuff here
  private void responseSetup(HttpServletResponse response) {
      response.setContenType("text/html;charset=windows-1257");
}Then subclasses would use doGetWork and doPostWork like notmal HttpServlet subclasses would use doGet and doPost...

Similar Messages

  • Hello i need a help about script to export translatable text strings from ai files and import them back

    Hello i need a help about script to export translatable text strings from ai files and import them back after editing, thanks in advance

    Lanny -
    Thank you for taking the time to help with this problem. Can I just say however that as someone who has posted a first comment here and quite clearly never used a forum like this before, your comment unfortunately comes across as very excluding. It makes me feel there are a set of unwritten rules that I should know, and that I don't know them shows that the forum is not for me. In short, it's exactly the kind of response that stops people like me using forums like this.
    I'm sure it's not intended to be received like this and I am sure that the way you have responded is quite normal in the rules of a forum like this. However, it is not normal for those of us who aren't familiar with forums and who only encounter them when they have a genuine problem. This is why I hope it is helpful to respond in full.
    The reason I posted here is as follows. I was directed here by the apple support website. The original comment seemed to be the only one I could find which referred to my issue. As there is no obvious guidance on how to post on a forum like this it seemed perfectly reasonable to try and join in a conversation which might solve more than one problem at once.
    Bee's reply however is both helpful and warm. This could in fact be a template for how new members should be welcomed and inducted into the rules of the forum in a friendly and inclusive way. Thank you very much indeed Bee!

  • Beginner in java and need your help about DES

    hello,
    I m a new guy in java programming and learn from many books.I m making a website and portal right now and dying need your help about DES.my portal (using java) requires somebody to make a login name and a password.I m done with the server and client things and rite now stuck with this "DES" stuff.
    so I make some conditions and algorithm below..
    1. when a user login,the password is encrypted.at this point,cleartext(id) and encryption (M,N) are involve.
    2. then the key is changed based on algorithm.
    3.the key changed by key(id) is received and the original text should be encrypted.
    the algorithm
    1. the original text x1.x2.x3.x4.x5.x6.x7.x8 (64 bits)
    2. encypt the password
    a. Each character is changed into an int type by the ASCII code, and let the 1st bit be an odd number parity bit.
    b.The 1st bit of the 1st character in (IP) is set to '1', and the 8th bit of the 8th character as '64'.
    c.the rest (IP) is like this
    1 2 3 4 5 6 7 8
    0 # 58 50 42 34 26 18 10 2
    8 # 60 52 44 36 28 20 12 4
    16 # 62 54 46 38 30 22 14 6
    24 # 64 46 48 40 32 24 16 8
    32 # 57 49 41 33 25 17 9 1
    40 # 59 51 43 35 27 19 11 3
    48 # 61 53 45 37 29 21 13 5
    56 # 63 55 47 39 31 23 15 7
    d. and lastly,from above,,it should be done like this
    1 2 3 4 5 6 7
    0 # 40 8 48 16 56 24 64 32
    8 # 39 7 27 15 55 23 53 31
    16 # 38 6 26 14 54 22 52 30
    24 # 37 5 25 13 53 21 51 29
    32 # 36 4 24 12 52 20 50 28
    40 # 35 3 23 11 51 19 49 27
    48 # 34 2 21 10 50 18 48 26
    56 # 33 1 20 9 49 17 47 25
    e. key y1,y2,y3,y4,y5,y6,y7,y8 (64bit)
    f. generate the key based on ID
    a. Each character is changed into an int type by the ASCII code, and let the 1st bit be an even number parity bit.
    b.the process is repeat again.
    anybody has an idea to help me with the sample program?
    thanks in advance...

    just ask about a simple program how to receive a
    password from somebody and change it to a key..and
    then confirm it with DES.Once again I have a problem understanding what you are asking.
    Are you trying to use the password as a key to encrypt some 'standard thing' and place this encrypted value in a database? If so then look in the JCE for 'password based encryption' such as PBEWithMD5AndDes. This seems back to front to me but I can see nothing wrong with the approach since the 'standard thing' you would encrypt is in effect a key. If this is for a commercial application then I would find a security expert to evaluate your proposal!
    In my experience it is more normal to encrypt the user's password with DES and store the result in the database. To do this just look in the JCE for DES encryption and consider using DES with CBC and PKCS5 padding. Also, consider encrypting the concatenation of the user's 'user name' with the password as this will (almost certainly) avoid having two encrypted values in the database that are the same even if two users have the same password.
    For both of these you might consider using Base64 or Hex to turn you encrpted bytes into ASCII characters before trying to store them in your DB.

  • In Need of Help Creating an Action

    Hello,
    I need to create several thousand QR codes and I am trying to work out how to automate it so that I don't have to make them one at a time.
    My idea was to download the EVEnX QR Code plugin for Photoshop and then make an action, or series of actions, to make the codes en mass. The information I need in each QR Code is a URL, with each code having a unique one that links to the products serial number.
    So, I created a file roughly the size of the QR codes I needed and used vairables to insert the URL on text layer. I was hoping to be able to create an action that would copy that text, open the plugin (which works like a filter), paste the text, create the code and save/close the image.
    However, I can't seem to get it to work. I don't know how to make an action to have it highlight the text layer or an action to paste it into the plugin.
    Also, the plugin allows you to make a variable of certain information it pulls from the file but the closest I can get to what I need is file name, however I can't make the files named for the URL because of the slashes. They allows you to use file name, file path and the information like size and date.
    Sorry for the long post but I HAVE to get this figured out as this project is for work and I am on a time limit. I don't have to use an action, any other way would be fine! I don't have much experience with scripts but if you can walk me through one that would work then I would be happy to try! PLEASE HELP!!!
    Thanks!
    In Need of Help Creating an Action

    Have you checked out Image > Variables and the Help chapter »Creating data-driven graphics« yet?

  • Need to help about deploying oracle forms on AS

    well i need help in deploying my webforms on the AS THAT is on redhat linux 2 help me with some material or links that provide me how to deploye my application on it
    alos i need to know about complete help guide for the deploying of database on database server that is on linux and deploying forms on AS WHICH is also on linux

    we have an application in developer /2000 that we will be deploying on the internet using Oracle 9iAS. we also want to provide limited access to the application / information from PDA, cell phones, etc. Can I take advantage of existing code in developer/2000 that can be used with Oracle 9i wireless?

  • Need some help: About DVD/BD authoring in Encore 5.1

    Hello everyone,
    I am new to Adobe Encore 5.1 (newly switched to)
    I was wondering if anyone could help me with problems that i am currently dealing with.
    I made some dvd everything works great in my laptop and dvd player, but when i sent those dvds to my favorite in America, she is telling that dvds aren't playing on her player there.
    before creating my projects i did a little bit of research for creating dvds NTSC specifically that could be playble in US, but i guess it wasn't enough.
    Anyways, all default footages were recorded in PAL system and I edited and converted them to NTSC system with Sony Vegas Movie Studio HD Platinum 10.0 application.
    For dvd menus, I used Sony DVD Architect Studio 5.0 again NTSC default setting, from what i understood was that, DVD Architect studio creates free region and i didnt find any option for selecting region 1, 2 or 3, like Encore 5.1.
    it seems to be a bit complicated or something, i need to make the things right. and i need your help.
    I have another question, is it possible to make all your editings in Sony vegas and use Encore 5.1 for dvd or blu ray authoring.
    Thank you very much.

    Stan Jones wrote:
    So one possibility is that they are not correct NTSC. Make a very short test sample of the video and put it in an Encore NTSC project with no menu. Make it first play. Build to an iso image. You can post that so we can burn and test it.
    If she was able to play the menu, but not the movie, that's good. If not, you can also post the psd of the menu for us to test.
    Thank you for replying back. Yesterday I contacted her back about those DVDs, she told me that 2 DVDs are working perfectly but other 2 dvds are giving format error on her Blu ray player. I assume, it might be burning problem or encoding, but all dvds are made with same settings. it's really weird to me.
    About the content, I am not allow to upload them (upon my friend's request), but i will record some footage with the same setting and I will upload them here.

  • Need some help about i18n on Redhat 71. with Oracle 8.1.7

    Initally I used Redhat 7.0 with Oracle 8.1.7, everything had worked find until I upgrade my system to Redhat 7.1.
    I have no idea about Redhat locate setting. Well, I use NLS_LANG=TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 to inital database . some character like '3\' had worked fine. Now '3\' will become '3\\' after inserting into tables.
    It's a emergent event! plz help me. I will appreciate your kindness ;>

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dragoon Chang ([email protected]):
    Initally I used Redhat 7.0 with Oracle 8.1.7, everything had worked find until I upgrade my system to Redhat 7.1.
    I have no idea about Redhat locate setting. Well, I use NLS_LANG=TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 to inital database . some character like '3\' had worked fine. Now '3\' will become '3\\' after inserting into tables.
    It's a emergent event! plz help me. I will appreciate your kindness ;><HR></BLOCKQUOTE>
    sorry ... I make a big mistake ... :)
    After directlly connecting with sqlplus, I find out it's ok to use sql command.
    well, The problem comes with PHP ...
    I will try out the php.

  • Need some help about Win 8.1 and linux with a dual boot

    Hi!
    I have a Lenovo z50-70 notebook and I have a Windows 8.1 on it. (The one which was shipped with this notebook...)
    My concerns are Intalling Linux as a dual boot and loosing Windows 8.1.
    As I am not familiar to Win 8.1, the product key is in the ?BIOS? and there's a lot of partitions...
    If I install Linux Ubuntu (latest version) as a dual boot by manually making the partitions, etc. and then if I lose my Windows 8.1 system, how can I get it back?
    I've made a backup of the system to the portable hdd but I don't know can I restore it, as I have no win installation disc and I am not sure if i can restore win 8.1 from the backup by using random win 8 installation disc that I've made from the downloaded ISO (for e.g. Win 8.1 pro iso from internet)...
    I need a Linux distro for developing my Android ROM but I don't want to lose that Win 8.1 OS from my notebook. So.. What should I do?

    Did you do a full disc backup of the C: Drive using a backup tool other than windows? If you did, then the recover of that partition will be up to your backup software.
    If worse comes to worse, you can use the novo button to restore your computer to what it was like when it came from the factory. But there really is nothing to worry about. Create your new partition and just make sure that you install Linux to that partition. Make sure it is not the same size as any other partition, that way even if the Linux installer does not show the volume labels, you can tell which partition you want to install Linux in just by the size.
    Hoov
    Microsoft MVP - Consumer Security
    SpywareHammer.com

  • Need serious help about understanding settings on photoshop for the best quality- please reply is you know a lot about this.

    Ideally I'd like to speak to someone from the UK as I feel I can't write out everything I want to say because it's too confusing and it isn't just one question.
    I need help with setting photoshop so the images are the best quality on screen and for websites and printing and how I can change that etc I've heard different things and I just need some clarification and advice.
    Obviously I'm sure some of you wont want to give personal details out that's fine but I'm generally just in need of some advice, let me know if you can help:)

    I don't change any settings.  For 1X web images I always use Save for Web.  PS remembers which web settings you used the last time.   This doesn't effect other files or formats.
    Image optimization — Web Fundamentals
    Improving Images for Hi-Res Retina Displays
    A guide for creating a better retina web - Ivo Mynttinen / User Interface Designer
    Serving Hi-Res images only to High Density Displays with PHP
    Retina Images
    Seriously, you can drive yourself crazy with all this Retina display stuff.  I don't see much upside to it except for very special situations.
    Nancy O.

  • Need Ur Help about installation of Mac OSX

    Hello !
    I'm trying to install MAC on my PC, but i can't
    I've been booting from a DVD, but when the apple with grey background appears my PC halted and need to restart. I'm using this DVD file "SnowOSX_Universal_10.6(432)GM_v3.5"...
    I would like to ask you which version do you recommend me to install along with where can i download it.
    My computer detail are as under,
    Intel Core (TM) 2 CPU
    6600 @ 2.40GHZ
    RAM 2GB
    Thanks & Regards,
    Awiting your prompt action in this regard,

    It is NOT possible and it is Illegal under the Terms of Useage to install any version of OS X onto a Windows based PC.  You may and can only install it onto Apple computers. 
    Hope this helps

  • I need your help about method for 'Seperating Keypad'

    Hi~ I'm a logic user.
    I used to be a PC version logic platinum user.
    And, I'm moving to Mac OS.
    So, I bought Logic Express.
    I just want to set up 'my style keycommand'.
    Especially, seperating numbers on keyboard and keypad.
    (For example, number 1 on keyboard to 'Screen01' and number 1 on keypad to 'Rewind'.)
    My equipments are is Macbook air and USB keyboard(A1243-109key)
    I bought this extra keyboard for more convenient use at home.
    and, have done all through the Manual.
    Preference < Keycommand < option < preset < US with numeric Keypad selecting (if only 109 key) < Learn by key position & Pressing number 1 on keypad.
    But, doesn't work.
    Only with message like 'already assigned to the Screen01, will you really change?'
    In short, keypad can't be seperated.
    Can you help me?
    1. Do I have to adjust keyboard to Mac before loading Logic?
    2. Is the seperating impossible in case of Macbook + normal Keyboard?
    3. Can you guess what is the problem?
    I need your cooperation~
    Thank you~

    Please post this in Portal forum. This is Reports forum

  • Need some help about a query

    Hello,
    I'm new to oracle DB.
    Can someone help me with this query please?
    I want a query which returns the details of all the DML and DDl queries performed on a database in a particular period of time like for example from that date to today.
    Thank you..

    All changes made to user data or to the data dictionary are recorded in the Oracle redo logs. Therefore, redo logs contain all the necessary information to perform recovery operations. Because redo log data is often kept in archived files, the data is already available.
    Actually to do this you got to have DBA privileges.
    You have to use oracle LOGMINER
    Oracle Corporation provides SQL access to the redo logs through LogMiner, which is part of the Oracle database server. LogMiner presents the information in the redo logs through the V$LOGMNR_CONTENTS fixed view. This view contains historical information about changes made to the database
    Please refer the following link to get more details on the same.
    http://docs.oracle.com/cd/B10501_01/server.920/a96521/logminer.htm
    Hope this helps :)

  • I need a help about Oracle Ultra Search

    Someone help me find out document about Oracle Ultra Search installation step by step clearly .
    Thanks.

    Have you tried the Oracle Ultra Search Administrator's Guide?
    http://download-west.oracle.com/docs/cd/B14099_15/portal.1012/b14041/toc.htm
    Beth

  • I need some help about Group by sql statement.

    Thank you for reading my post
    I am learning more sql and i have a question which is about HR schem.
    how i can show Departments.department_name in the following sql query?
    I want query to show department names along with department IDs.
    SELECT department_id dept_id, job_id, SUM(salary)
    FROM employees
    GROUP BY department_id, job_id ;thanks

    hi
    like this
    SQL> ed
    Wrote file afiedt.buf
      1  select d.department_id dept_id, d.department_name, e.job_id, sum(e.salary)
      2  from employees e, departments d
      3  where e.department_id = d.department_id
      4* group by d.department_id, d.department_name, e.job_id
    SQL> /
       DEPT_ID DEPARTMENT_NAME                JOB_ID     SUM(E.SALARY)
            10 Administration                 AD_ASST             4400
            20 Marketing                      MK_MAN             13000
            20 Marketing                      MK_REP              6000
            30 Purchasing                     PU_MAN             11000
            30 Purchasing                     PU_CLERK           13900
            40 Human Resources                HR_REP              6500
            50 Shipping                       ST_MAN             36400
            50 Shipping                       SH_CLERK           64300
            50 Shipping                       ST_CLERK           55700
            60 IT                             IT_PROG            28800
            70 Public Relations               PR_REP             10000
       DEPT_ID DEPARTMENT_NAME                JOB_ID     SUM(E.SALARY)
            80 Sales                          SA_MAN             61000
            80 Sales                          SA_REP            243500
            90 Executive                      AD_VP              34000
            90 Executive                      AD_PRES            24000
           100 Finance                        FI_MGR             12000
           100 Finance                        FI_ACCOUNT         39600
           110 Accounting                     AC_MGR             12000
           110 Accounting                     AC_ACCOUNT          8300
    19 rows selected.
    SQL>hope this helps
    Taj

  • Need Detailed Help about storing at home, downloading on the go.

    I have a computer I have used itunes on without fail for about a year now, the only problem? I am running out of room on my laptop's hard drive, so I purchased a 1.5TB External Hard drive, which I would like to leave at home, I am currently moving all my itunes files to this new hard drive, however,
    1. I would still like to be able to sync my ipod on the go without losing the current music i have on my external drive at home.
    2. I would like to continue to download music onto my laptops hard drive, then transfer them to my itunes library on my new external hard drive when I return home. (as I am gone for work 2 weeks at a time) without messing up all my files.
    Is there an easy way to do this? what do I need to set my iphone options to so my stuff won't be deleted, and how can I download music to two different spots to keep my library nicely organized?

    Are you planning to take that hard drive with you when you're out and about? If so, then drag the entire iTunes folder (the entire folder, not just the iTunes Music folder) from your computer's internal drive to your desired location on the external drive. Then hold down the Shift key while launching iTunes. You'll be given a dialog box where you can select the iTunes library you want to use. Navigate to and select the iTunes folder in it's new location. iTunes will then be working entirely from the external drive, and you can repeat this procedure on any computer to which you connect your drive and iTunes should work the same as on your home system, including (to the best of my knowledge; I haven't tried this when hauling my secondary drive around) synching to your iPod.
    Note that this procedure assumes that all of your tracks are contained in the iTunes Music folder. If they're scattered around your volumes, moving them becomes much more complex. Note also that if you launch iTunes before the drive is connected and mounted, iTunes will automatically switch back to it's default location on the internal drive, in which case you'll have to quit and relaunch iTunes while holding down the Shift key and reselect the external drive.
    Warning: don't delete the tracks from the old location on the internal drive until you've confirmed that they're working correctly from the external drive.

Maybe you are looking for

  • Adding data to Manual Distribution Rule from DIAPI

    Hi I am searching for the object to insert the data to OMDR (manual distribution rule) using DI API. Can any one help me out. I found many questions related to adding data to manual distribution rule using DIAPI which were not answered. Thanks in Adv

  • Authentication error

    Hello, I have Linksys router WAG120N & Linksys Range Expander WRE54G. When I try to connect both of them, connection is successful. But if a device such as Samsung Galaxy S4 tries to connect to Range Expander, Authentication error occures. But when t

  • HT1688 Is it possible to delete a phone number from Messaging history?

    Is it possible to delete a phone number from MESSAGING History?

  • Org Structure Craetion - 2

    There is a req to create new Company since client moved into new business. Company Policies, Work Timings, Leaves everything remains same including Grades & Levels, everything will be same. Finance Team Created New Company Code... For my part I intia

  • AirPort Utility can't see either AEBS or AirPort Express using either comp.

    I have an AirPort Extreme Base Station (AEBS) and an AirPort Express (APE). The dsl connects to the AEBS via ethernet (in the first slot), and the AEBS connects to the desktop via ethernet (in the second slot; it has no AirPort card). The PowerBook (