Skip to main content

Posts

Showing posts from 2013

Spring Default Limit for Collection and Array is 256

If you are working in Web Application Development then you may stuck or already had ,then you will get mad of getting this error


java.lang.ArrayIndexOutOfBoundsException:Arrayindexoutofrange256
How this error emanates in Spring?

i will explain you with example.Suppose you are adding Values in List in JSP using JSTL tag or other.
This list is in Form(HTML).When you POST this form,In behind Stage,Spring does binding of Object and List if present.

But wait...
In Spring,Default limit for array and collection growing is 256.

Why this limit is Set?

seldom you have to send List size greater than this limit.
Spring has set this limit to avoid notable OutOfMemoryErrors in case of large indexes.

So,than What if i want to set Collection greater than this size?

I had told earlier,spring does binding behind.If we tell spring to increase it's size or set collection size behalf of spring.
You you can do it.

We have initBinder,  in Spring  it is called when spring does the binding mechanism
e.g @Mod…

Spring Web Services (Spring-WS)

What is meant by Spring-WS?
It is Web-Services provided by Spring Community and all spring capability are provided within this service such as dependency Injection. It is document-driven web-service. Is it Bounce? That means all requirements are specified first than web-service is written (actual code).
E.g. what data is to be send in request and what will be its response. So these things are decided first and then only you can easily write the code in case of spring-WS.

Why there is such thing of decide first and then code in Spring-WS? Or this just a theory that i just telling you to make you jumble?

No, of course not.Spring uses contract-first development in which there is loose coupling between contract and its implementation.
e.g You will first design WSDL (an XML document that describes web-service) and then its java implementation of contract.

Remember Spring -WS is Contract-First.
So start with the implementation of web-service.I will show it in step-wise manner.

We will develo…

Spring Custom Event Handling Tutorial

What are spring Custom Events?Spring Framework provides in-built API for context management and even for custom event creation for you.Spring Event management follows Observer Design Pattern. In observer Design pattern there is loose coupling between objects.There three main components it has                     1 .Publisher object which publish event/call event                      2. Listener object which listens the event that occurred                      3. Event object which used to communicatee.g:an event publisher (subject) object can communicate with other objects without knowing which object is listening and event listener (handler) can work with event without knowing which object published the event.
What is use of of creating custom Event?Mostly we take in consideration of custom event when we want to do some notifications.e.g. One can write Blog (Publisher),People subscribe the blogs (Listener)when new content added in blog,all people who subscribed this blog will get noti…

Apache FOP Tutorial for PDF Generation

What is meant by Apache FOP?

Apache is providing open source JAVA application for PDF(or any other format) file generation from XML data.Simply to can give data in XML,it gives output in PDF or any format.But it is primary for PDF output.

Official explanation,
OP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects (XSL-FO) and the world's first output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT

How wcan configure apache fop with our project?

I am going to explain how to generate PDF using Apache FOP.
I will explain it in steps

Step 1:
You will require 3 jar for configurations.Here fop jar depend on both avalon api and avalon impl.
              1.    apache fop 1.1
              2.    avalon-framework-api 4.3.1
    …