Search Results

Search found 4035 results on 162 pages for 'extends'.

Page 80/162 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • Spring MVC 3.1 How to access HttpSession in Custom Authentication Provider (which implements AuthenticationProvider)

    - by user1506231
    My application calls a web service during the Authentication process (as shown in code below). How can I save some information in HttpSession during this process? This information like customer-account-number will be used in various other places in the application after the user is logged in. Is it possible to pass HttpSession parameter to the MyServiceManager's static login method? public class MyAuthenticationManager implements AuthenticationProvider { @Override public boolean supports(Class<? extends Object> authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } @Override public Authentication authenticate(Authentication authentication) { //MyServiceManager.login - makes a call to web service if(MyServiceManager.login(authentication.getName(), authentication.getCredentials().toString(), XXX_HTTP_SESSION_XXX)) { List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority> (); authorities.add(new GrantedAuthorityImpl("ROLE_USER")); authorities.add(new GrantedAuthorityImpl("ROLE_SUPERVISOR")); return new UsernamePasswordAuthenticationToken(authentication.getName(), authentication.getCredentials(),authorities); } else { return null; } } }

    Read the article

  • Simple Java Sound Applet won't work!!! ARG!!!

    - by William
    import java.applet.*; /** * SoundApplet.java - a simple applet that plays the "gong.au" sound file. */ public class AppletGame extends Applet { public void init() { super.init(); resize(0,0); AudioClip gong = getAudioClip(getDocumentBase(), "test0.au"); gong.play(); } } In Eclipse applet viewer it loads and doesn't play sound. In html it doesn't load and says start not initalized. I've tried calling it outside of init, and all that someone help me!!!

    Read the article

  • R.id cannot be resolved

    - by Soren
    So I copied this tutorial example thing right from Google's android site and I ma getting an error that R.id cannot be resolved. Here is my Java file package com.TestApp.HelloWebView; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class HelloWebView extends Activity { WebView mWebView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("http://www.google.com"); } } Here is my main.xml <?xml version="1.0" encoding="utf-8"?> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

    Read the article

  • WPF: how to make normal listbox left-drag-select behavior use middle mouse instead?

    - by Scott Bilas
    I'm building a special listbox control that our designers want customized in some tweaky ways. One thing they want to see is that the middle button-drag does what the left button-drag normally does (we are repurposing left-drag to other things). So it needs the two key features that left-drag does in a ListBox default implementation: While holding down the button and dragging, the selection starts where I click down and extends to where I drag. While dragging outside the listbox region, it scrolls if there is scrollable space in that direction. Before I go an duplicate this functionality by hand, is there any easy way to fool ListBox into thinking it's getting left-mouse drag events but instead is getting middle-mouse?

    Read the article

  • afterTransactionCompletion not working

    - by Attilah
    I created an hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[] arg3, Type[] arg4) throws CallbackException { for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(onSave) : "+entity.toString()); } if(entity instanceof Canal){ isCanal=true; } return false; } public void afterTransactionCompletion(Transaction tx){ if(tx.wasCommitted()&&(isCanal)){ for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(afterTransactionCompletion) : Canal was saved to DB."); } } } but the method afterTransactionCompletion doesn't get executed after a transaction is commited. I've tried all the ways I know of but I can't make it work. What's more surprising is that the onSave method works fine. Help ! Could this be due to this bug ? : http://opensource.atlassian.com/projects/hibernate/browse/HHH-1956 How can I circumvent this bug if it's the cause ?

    Read the article

  • Error: cant find main class

    - by Vurb
    ok so im a newbie java dev using netbeans IDE 7.1.1 and im watching this tutorial and right off the bat i get an error in my program even after 5 retypes to make sure its exactly the same as in the video so anyways this is the error Error: Could not find or load main class javagame.JavaGame Java Result: 1 and this is the code i have written package JavaGame; import javax.swing.JFrame; public class JavaGame extends JFrame { public JavaGame(){ setTitle("java game"); setSize(500, 500); setResizable(false); setVisible(true); //setDefaultCloseOperation(); } public static void main(String[] args){ } }

    Read the article

  • Validation of method parameters

    - by Anton Tsivarev
    I have a RESTful web service. For implementation using JAX-RS (Jersey). Have the following method: public void foo (@PathParam ("name") String uuid) { ... } I need to do validation of input parameters. And if data invalid throw WebApplicationException. I added my custom annotation CheckUuid (extends ): public void foo (@PathParam ("name") @CheckUuid String uuid) { ... } Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?

    Read the article

  • Intellij UML diagram does not show one to many relationships

    - by Calm Storm
    I am trying to follow http://www.jetbrains.com/idea/features/uml_class_diagram.html I have a few classes so when I do Ctrl + Alt + U I only see all classes and just Extends relationships. Please note that I have set the "Diagrams" options in my settings to show one to many etc. I do not see One to One, One to Many relationships at all ? I have used JPA OneToOne Annotations and they dont turn up at all? Pressing Ctrl Shift F12 does not do anything? Can someone please explain?

    Read the article

  • Android ImageButton not firing the onclick event, what is wrong with my code?

    - by kimo
    I have very simple code that includes ImageButton with OnClickListener that points to another Activity, the click on the ImageButton doesn't fire the onClick (The same problem was with Button) : public class ToolsActivity extends Activity { private ImageButton btnCamera; final Context context = ToolsActivity.this; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tools); this.btnCamera = (ImageButton) findViewById(R.id.cameraButton); this.btnCamera.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(context,MainActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_tools, menu); return true; } XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="16dp" android:paddingRight="16dp" > <ImageButton android:id="@+id/cameraButton" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/btncamera" android:contentDescription="@string/desc" />

    Read the article

  • null pointer exception on list.add

    - by Eric
    I've been working on this one error for a few hours so I thought I'd pick the brains of some pros. I am getting a null pointer exception at the modelData.add(i, es) method. I know from debugging that es isn't null. I'm really confused, thanks. public class EventTableModel extends AbstractTableModel { //private int rowCount = 0; protected List<EventSeat> modelData; private static final int COLUMN_COUNT = 3; private Event e; Event j = GUIpos.m; int i = 1; public EventTableModel(Event e) { this.e = e; try { System.out.println(modelData); for (EventSeat es : e.getEventSeats()) { modelData.add(i, es); i++; } } catch (DataException ex) { Logger.getLogger(EventTableModel.class.getName()).log(Level.SEVERE, null, ex); } }

    Read the article

  • How to use separat block caches for secure and unsecure shop access in Magento?

    - by Uwe Mesecke
    I use the Magento block cache for the top navigation block. The problem is the block has to generate some urls for files in the skin directory that cannot be put into css files as the file names depend on category model data. Now when I open magento using a secure connection (https://) the navigation block is fetched from the cache and is sent to the browser but with the http:// urls resulting in a warning in most browsers about unsecure elements on the page. I'd like the have separat caches for secure and unsecure connections. The navigation block extends the class Mage_Catalog_Block_Navigation and therefore has the following cache configuration: $this->addData(array( 'cache_lifetime' => false, 'cache_tags' => array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Core_Model_Store_Group::CACHE_TAG), ));

    Read the article

  • Guice child injector override binding

    - by Roman
    Hi All I am trying to to override a binding in a child injector that was already configured in a base injector. like that : public class PersistenceModule extends Abstract{ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(ProductPersistenceHelper.class); } } then : Injector injector = Guice.createInjector(new PersistenceModule()); injector.createChildInjector(new AbstractModule(){ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(MockProductPersistenceHelper.class); } }) Guice is complaining that it has already a binding for that. Are there any patterns or best practices for that problem ?

    Read the article

  • android thread management onPause

    - by Kwan Cheng
    I have a class that extends the Thread class and has its run method implemented as so. public void run(){ while(!terminate){ if(paused){ Thread.yield(); }else{ accummulator++; } } } This thread is spawned from the onCreate method. When my UI is hidden (when the Home key is pressed) my onPause method will set the paused flag to true and yield the tread. However in the DDMS I still see the uTime of the thread accumulate and its state as "running". So my question is. What is the proper way to stop the thread so that it does not use up CPU time?

    Read the article

  • Java Inheritance Concept Understanding

    - by Nirmal
    Hello All.... I am just refreshing the oops features of the java. So, I have a little confusion regarding inheritance concept. For that I have a following sample code : class Super{ int index = 5; public void printVal(){ System.out.println("Super"); } } class Sub extends Super{ int index = 2; public void printVal(){ System.out.println("Sub"); } } public class Runner { public static void main(String args[]){ Super sup = new Sub(); System.out.println(sup.index+","); sup.printVal(); } } Now above code is giving me output as : 5,Sub. Here, we are overriding printVal() method, so that is understandable that it is accessing child class method only. But I could not understand why it's accessing the value of x from Super class... Thanks in advance....

    Read the article

  • can we use layout in Customview ?

    - by UMMA
    friends, i have a custom view class public class Zoom extends View { private Drawable image; private int zoomControler=20; public Zoom(Context context) { super(context); image=context.getResources().getDrawable(R.drawable.icon); setFocusable(true); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //TransparentPanel tp = new TransparentPanel(this.getContext()); //Button MyButton = new Button(this.getContext()); //MyButton.setText("Press me"); //tp.addView(MyButton); image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler); image.draw(canvas); } } can i use SetContentView(R.layout.mylayout) in this custom view to display that design? or how can i display button with image ondraw method as i have commented the code ? any help would be appreciated.

    Read the article

  • java overloaded method

    - by Sean Nguyen
    Hi, I have an abstract template method: class abstract MyTemplate { public void something(Object obj) { doSomething(obj) } protected void doSomething(Object obj); } class MyImpl extends MyTemplate { protected void doSomething(Object obj) { System.out.println("i am dealing with generic object"); } protected void doSomething(String str) { System.out.println("I am dealing with string"); } } public static void main(String[] args) { MyImpl impl = new MyImpl(); impl.something("abc"); // --> this return "i am dealing with generic object" } How can I print "I am dealing with string" w/o using instanceof in doSomething(Object obj)? Thanks,

    Read the article

  • Changing background color in Android SDK by clicking a button does not work

    - by DavidNg
    I have a simple program which is able to change the background color after clicking a button, but it does not work public class ChangeBackgroundActivity extends Activity { /** Called when the activity is first created. */ Button blueButton; LinearLayout myLO; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myLO=(LinearLayout)findViewById(R.layout.main); blueButton=(Button)findViewById(R.id.button1); blueButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub myLO.setBackgroundColor(0x0000FF); //blue color code #0000FF } }); } }

    Read the article

  • What's the purpuse behind wildcards and how are they different from generics?

    - by Nazgulled
    Hi, I never heard about wildcars until a few days ago and after reading my teacher's Java book, I'm still not sure about what's it for and wwhy would I need to use it. Let's say I have a super class Animal and few sub classes like Dog, Cat, Parrot, etc... Now I need to have a list of animals, my first thought would be something like: List<Animal> listAnimals Instead, my colleagues are recommending something like: List<? extends Animal> listAnimals Why should I use wildcards instead of simple generics? Let's say I need to have a get/set method, should I use the former or the later? How are they so different?

    Read the article

  • How can I send Data from BroadcastReceiver to Widget?

    - by Yverman
    I have a BroadcastReceiver which loads data from the Internet and then it should send them back to a Widget. But how can I do this? What I've already done is updating the Widget directly from the Broadcast, but I like to just send de data back. public class UpdateManager extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget); ComponentName thisWidget = new ComponentName(context, Widget.class); remoteViews.setTextViewText(R.id.widget_textview, "UPDATE DONE"); appWidgetManager.updateAppWidget(thisWidget, remoteViews); } }

    Read the article

  • Nested Dynamic PHP Class

    - by user338844
    Alright, I may just need a terminology update, but I have been playing in Magento and Joomla, and they do references like $mage = new Mage; $mage->block('blockname'); where class Mage through some process I am failing to figure out is calling: class blockname extends something{ } Don't quote me on that code, however I am looking to do something like that where I have a file that I can do $myscript-block('blockname'); and it will load and call the file with class blockname. I hope that is not too confusing, but any help is appreciated. Thanks in advance!

    Read the article

  • Overload and hide methods in Java

    - by Marco
    Hi, i have an abstract class BaseClass with a public insert() method: public abstract class BaseClass { public void insert(Object object) { // Do something } } which is extended by many other classes. For some of those classes, however, the insert() method must have additional parameters, so that they instead of overriding it I overload the method of the base class with the parameters required, for example: public class SampleClass extends BaseClass { public void insert(Object object, Long param){ // Do Something } } Now, if i instantiate the SampleClass class, i have two insert() methods: SampleClass sampleClass = new SampleClass(); sampleClass.insert(Object object); sampleClass.insert(Object object, Long param); what i'd like to do is to hide the insert() method defined in the base class, so that just the overload would be visible: SampleClass sampleClass = new SampleClass(); sampleClass.insert(Object object, Long param); Could this be done in OOP?

    Read the article

  • Binding a select box to a Collection (with Spring)

    - by WiPU
    i have the following problem. I have a form bean and in this bean is a list with objects. List<SomeObjectForm> toDisplay; Now i want map a html select to this list. Something like that: <form:select id="inputGroupFields" path="templateKey" multiple="true"... <form:select id="inputGroupFields" path="templateKey.id" multiple="true"... And this dosnt work of course. Now i have tryed to add different custom Converter like: myConv implements Converter<SomeObjectForm, String> myConv extends StringToObject And this also not work. I'm not sure if this is the right approach or there is a easier way to do that. Some addional Infos: --i'm using spring 3.0.5 --all this happens during a web flow regards and thanks, WiPu

    Read the article

  • Scala, represent pattern of boolean tuple into something else.

    - by Berlin Brown
    This is a cellular automata rule (input Boolean == Left, Center, Right Cell) and output Boolean . What is a better way to represent this in Scala. trait Rule { def ruleId() : Int def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean override def toString : String = "Rule:" + ruleId } class Rule90 extends Rule { def ruleId() = 90 def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean = { // Verbose version, show all 8 states inputState match { case (true, true, true) => false case (true, false, true) => false case (false, true, false) => false case (false, false, false) => false case _ => true } } }

    Read the article

  • PHP Variable from extended class

    - by Ste
    I cant retrieve var from parent class: class core { var $variable; var $test; function __construct() {} public function setVar($var) $this->variable = $var; } } class test extends core { public function getVar() { return $this->variable; //also if i echo here i can't see !!!! } } $core = new core(); $core->test = new test(); print $core->test->getVar(); Any help??

    Read the article

  • ImageView Force closes my application

    - by BlueFireLady
    Hi there I am really a beginner, and I have been fighting with this problem for 3 days. :( I am able to get an image to show using a grid view and an adapter as in the grid view tutorial, but I wanted to be able to just use ImageView in the xml. public class HelloImage extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView gridview = (ImageView) findViewById(R.id.gridview); gridview.setLayoutParams(new GridView.LayoutParams(85, 85)); gridview.setScaleType(ImageView.ScaleType.CENTER_CROP); gridview.setPadding(8, 8, 8, 8); gridview.setImageResource(R.drawable.hand_tool); } } When I run this it causes the app to force close when loading.

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >